2 releases

Uses old Rust 2015

0.1.1 May 1, 2016
0.1.0 Nov 8, 2015

#1136 in Algorithms

Download history 26076/week @ 2024-08-27 24823/week @ 2024-09-03 23095/week @ 2024-09-10 21155/week @ 2024-09-17 23378/week @ 2024-09-24 23728/week @ 2024-10-01 24214/week @ 2024-10-08 22092/week @ 2024-10-15 22850/week @ 2024-10-22 25610/week @ 2024-10-29 25321/week @ 2024-11-05 31319/week @ 2024-11-12 31323/week @ 2024-11-19 28623/week @ 2024-11-26 23423/week @ 2024-12-03 26537/week @ 2024-12-10

114,723 downloads per month
Used in 100 crates (27 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