[−][src]Trait kmpsearch::Haystack
The Haystack trait is the 'target' of the KMP algorithm provided by this library. It provides the pattern_table method (part of the KMP algorithm) and the contains_needle method. Haystack is implemented on all types that can be converted to a &u8, such as Byte slices, str and Strings.
Required methods
fn contains_needle<N: AsRef<[u8]>>(&self, needle: N) -> bool
Returns true if this Haystack contains needle.
Provided methods
fn pattern_table(needle: &[u8]) -> Vec<usize>
Produce a 'pattern table' for use with the Knuth Morris Pratt algorithm