pub trait StringZilla<N>
where N: AsRef<[u8]>,
{ // Required methods fn sz_find(&self, needle: N) -> Option<usize>; fn sz_rfind(&self, needle: N) -> Option<usize>; fn sz_find_char_from(&self, needles: N) -> Option<usize>; fn sz_rfind_char_from(&self, needles: N) -> Option<usize>; fn sz_find_char_not_from(&self, needles: N) -> Option<usize>; fn sz_rfind_char_not_from(&self, needles: N) -> Option<usize>; fn sz_edit_distance(&self, needle: N) -> usize; fn sz_alignment_score( &self, needle: N, matrix: [[i8; 256]; 256], gap: i8 ) -> isize; }
Expand description

The StringZilla trait provides a collection of string searching and manipulation functionalities.

Required Methods§

source

fn sz_find(&self, needle: N) -> Option<usize>

Locates first matching substring. Equivalent to memmem(haystack, h_length, needle, n_length) in LibC. Similar to strstr(haystack, needle) in LibC, but requires known length.

source

fn sz_rfind(&self, needle: N) -> Option<usize>

Locates the last matching substring.

source

fn sz_find_char_from(&self, needles: N) -> Option<usize>

Finds the first character in the haystack, that is present in the needle.

source

fn sz_rfind_char_from(&self, needles: N) -> Option<usize>

Finds the last character in the haystack, that is present in the needle.

source

fn sz_find_char_not_from(&self, needles: N) -> Option<usize>

Finds the first character in the haystack, that is not present in the needle.

source

fn sz_rfind_char_not_from(&self, needles: N) -> Option<usize>

Finds the last character in the haystack, that is not present in the needle.

source

fn sz_edit_distance(&self, needle: N) -> usize

Computes the Levenshtein edit-distance between two strings using the Wagner-Fisher algorithm. Similar to the Needleman-Wunsch alignment algorithm. Often used in fuzzy string matching.

source

fn sz_alignment_score( &self, needle: N, matrix: [[i8; 256]; 256], gap: i8 ) -> isize

Computes Needleman–Wunsch alignment score for two strings. Often used in bioinformatics and cheminformatics. Similar to the Levenshtein edit-distance, parameterized for gap and substitution penalties.

Implementors§

source§

impl<T, N> StringZilla<N> for T
where T: AsRef<[u8]>, N: AsRef<[u8]>,