2 releases

Uses old Rust 2015

0.1.1 May 1, 2016
0.1.0 Nov 8, 2015

#1037 in Algorithms

Download history 25309/week @ 2024-07-20 25257/week @ 2024-07-27 22346/week @ 2024-08-03 19749/week @ 2024-08-10 19402/week @ 2024-08-17 25680/week @ 2024-08-24 25466/week @ 2024-08-31 20491/week @ 2024-09-07 23955/week @ 2024-09-14 22386/week @ 2024-09-21 23961/week @ 2024-09-28 24471/week @ 2024-10-05 22714/week @ 2024-10-12 21766/week @ 2024-10-19 25830/week @ 2024-10-26 24178/week @ 2024-11-02

98,408 downloads per month
Used in 92 crates (24 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