https://github.com/shepmaster/jetscii
A tiny library to efficiently search strings for sets of ASCII characters and byte slices for sets of bytes.
https://github.com/shepmaster/jetscii
Last synced: about 1 year ago
JSON representation
A tiny library to efficiently search strings for sets of ASCII characters and byte slices for sets of bytes.
- Host: GitHub
- URL: https://github.com/shepmaster/jetscii
- Owner: shepmaster
- License: apache-2.0
- Created: 2015-05-08T00:28:50.000Z (about 11 years ago)
- Default Branch: main
- Last Pushed: 2024-08-14T17:35:33.000Z (almost 2 years ago)
- Last Synced: 2025-04-03T20:13:16.585Z (about 1 year ago)
- Language: Rust
- Homepage:
- Size: 156 KB
- Stars: 114
- Watchers: 10
- Forks: 21
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# Jetscii
A tiny library to efficiently search strings for sets of ASCII
characters or byte slices for sets of bytes.
[](https://crates.io/crates/jetscii) [][docs]
## Examples
### Searching for a set of ASCII characters
```rust
#[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
```rust
#[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][docs] for information about feature flags and benchmarks.
[docs]: https://docs.rs/jetscii/
## 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