memchr-rs

Crates.iomemchr-rs
lib.rsmemchr-rs
version1.0.11
created_at2025-12-17 21:37:34.201895+00
updated_at2025-12-21 18:29:00.267921+00
descriptionFast memchr and memchr2 implementations in Rust
homepage
repositoryhttps://github.com/xosnrdev/memchr-rs
max_upload_size
id1991180
size27,925
Success Kingsley (xosnrdev)

documentation

README

memchr-rs

Fast memchr and memchr2 implementations in Rust.

Originally extracted from microsoft/edit under the MIT license.

Usage

Add the following crate to your Cargo.toml and enable either/both the memchr and memchr2 feature as needed:

[dependencies]
memchr-rs = { version = "1", features = ["memchr"] }

Then, use the provided APIs to perform fast byte searches:

use memchr_rs::memchr;

fn main() {
    let haystack = b"Hello, world!";
    let index = memchr(b'w', haystack, 0);
    assert_eq!(index, 7);
    println!("Found 'w' at position: {index}");
}

For no_std environments, disable the default-features:

[dependencies]
memchr-rs = { version = "1", default-features = false, features = ["memchr"] }
Commit count: 0

cargo fmt