2 releases

0.1.1 May 1, 2016
0.1.0 Nov 8, 2015
Download history 305/week @ 2019-04-03 365/week @ 2019-04-10 319/week @ 2019-04-17 240/week @ 2019-04-24 253/week @ 2019-05-01 25/week @ 2019-05-08 235/week @ 2019-05-15 57/week @ 2019-05-22 63/week @ 2019-05-29 56/week @ 2019-06-05 94/week @ 2019-06-12 283/week @ 2019-06-19 475/week @ 2019-06-26 86/week @ 2019-07-03 132/week @ 2019-07-10

775 downloads per month
Used in 8 crates (3 directly)

MIT/Apache

15KB
172 lines

memmem

This is a crate for substring searching (with functionality similar to the memmem function in C). So far, it only contains a copy of the two-way search implementation from rust's standard library (but with an API that allows searching in &[u8]). Eventually, we plan to provide other searching algorithms, and possibly also some heuristics to choose a good searching algorithm based on the substring we are looking for.

Build status Coverage Status

Documentation


lib.rs:

A crate for string searching. The main trait is Searcher, which has a function for finding fixed things in long byte-strings. Currently, the only implementer of Searcher is TwoWaySearcher.

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));

No runtime deps