2 releases

Uses old Rust 2015

0.1.1 May 1, 2016
0.1.0 Nov 8, 2015

#1034 in Algorithms

Download history 14342/week @ 2023-11-20 20487/week @ 2023-11-27 18226/week @ 2023-12-04 16662/week @ 2023-12-11 10882/week @ 2023-12-18 7458/week @ 2023-12-25 17560/week @ 2024-01-01 22707/week @ 2024-01-08 25878/week @ 2024-01-15 23389/week @ 2024-01-22 19848/week @ 2024-01-29 18337/week @ 2024-02-05 16318/week @ 2024-02-12 14248/week @ 2024-02-19 15542/week @ 2024-02-26 15541/week @ 2024-03-04

62,603 downloads per month
Used in 63 crates (16 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