Crate naive_opt[][src]

The optimized naive string-search algorithm.

  • Enhanced with 1-byte search like the libc++ and the libstd++ string::find
  • Specializing in UTF-8 strings, which is a feature of rust
  • Support the zero overhead trait.

Examples

Example function:

use naive_opt::string_search;
let haystack = "111 a 111b";
let needle = "a";
let r = string_search(haystack, needle);
assert_eq!(r, Some(4));

Example trait 1:

use naive_opt::Search;
let haystack = "111 a 111b";
let needle = "a";
let r = haystack.search(needle);
assert_eq!(r, Some(4));

Example trait 2:

use naive_opt::SearchIn;
let haystack = "111 a 111b";
let needle = "a";
let r = needle.search_in(haystack);
assert_eq!(r, Some(4));

Structs

SearchIndices

Created with the method Search::search_indices().

Traits

Search

search the needle

SearchIn

search in the haystack

Functions

string_search

seach the needle in the haystack

string_search_indices

An iterator over the matches of the needle in the haystack.