#byte-slice #string-search #ascii #string #byte #search #simd

jetscii

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

13 releases

Uses old Rust 2015

0.5.3 Jul 7, 2022
0.5.1 Sep 18, 2021
0.5.0 May 6, 2021
0.4.4 Jun 10, 2019
0.3.1 Jul 29, 2015

#245 in Text processing

Download history 6517/week @ 2023-11-26 6585/week @ 2023-12-03 5241/week @ 2023-12-10 1386/week @ 2023-12-17 1740/week @ 2023-12-24 6250/week @ 2023-12-31 8008/week @ 2024-01-07 7323/week @ 2024-01-14 7023/week @ 2024-01-21 6896/week @ 2024-01-28 4067/week @ 2024-02-04 3553/week @ 2024-02-11 3472/week @ 2024-02-18 3360/week @ 2024-02-25 3183/week @ 2024-03-03 833/week @ 2024-03-10

11,181 downloads per month
Used in 44 crates (14 directly)

MIT/Apache

57KB
1.5K SLoC

Jetscii

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

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