#string #bytes #ascii #search #simd

jetscii

A tiny library to efficiently search strings and byte slices for sets of ASCII characters or bytes

9 releases

new 0.4.4 Jun 10, 2019
0.4.3 Aug 26, 2018
0.4.2 Jul 11, 2018
0.4.0 May 13, 2018
0.1.0 May 8, 2015

#10 in Hardware support

Download history 16/week @ 2019-02-25 20/week @ 2019-03-04 10/week @ 2019-03-11 11/week @ 2019-03-18 51/week @ 2019-03-25 11/week @ 2019-04-01 7/week @ 2019-04-08 4/week @ 2019-04-15 10/week @ 2019-04-22 4/week @ 2019-04-29 8/week @ 2019-05-06 12/week @ 2019-05-13 30/week @ 2019-05-20 30/week @ 2019-05-27 25/week @ 2019-06-03

71 downloads per month
Used in 5 crates

MIT/Apache

55KB
1K SLoC

Jetscii

A tiny library to efficiently search strings for sets of ASCII characters or byte slices for sets of bytes.

Build Status Current Version Documentation

Examples

Searching for a set of ASCII characters

#[macro_use]
extern crate jetscii;

fn main() {
    let part_number = "86-J52:rev1";
    let first = ascii_chars!('-', ':').find(part_number);
    assert_eq!(first, Some(2));
}

Searching for a set of bytes

#[macro_use]
extern crate jetscii;

fn main() {
    let raw_data = [0x00, 0x01, 0x10, 0xFF, 0x42];
    let first = bytes!(0x01, 0x10).find(&raw_data);
    assert_eq!(first, Some(1));
}

Check out the documentation for information about feature flags and benchmarks.

Contributing

  1. Fork it (https://github.com/shepmaster/jetscii/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Add a failing test.
  4. Add code to pass the test.
  5. Commit your changes (git commit -am 'Add some feature')
  6. Ensure tests pass.
  7. Push to the branch (git push origin my-new-feature)
  8. Create a new Pull Request

No runtime deps