Skip to main content

Crate memmem

Crate memmem 

Source
Expand description

A crate for substring searching, with functionality similar to the memmem function in C.

The main trait is Searcher, which finds fixed byte-strings in longer byte-strings. The only implementer is TwoWaySearcher, a copy of the two-way search implementation from Rust’s standard library adapted to search &[u8].

§Example

use memmem::{Searcher, TwoWaySearcher};
let search = TwoWaySearcher::new("dog".as_bytes());
assert_eq!(search.search_in("The quick brown fox jumped over the lazy dog.".as_bytes()), Some(41));

Structs§

TwoWaySearcher
Searches for a substring using the “two-way” algorithm of Crochemore and Perrin, D.

Traits§

Searcher
A trait that searches for patterns in byte-strings.