Struct boyer_moore_magiclen::byte::BMByte
source · pub struct BMByte { /* private fields */ }
Expand description
Using Boyer-Moore-MagicLen to search byte sub-sequences in any byte sequence, including self-synchronizing string encoding data such as UTF-8.
Implementations§
source§impl BMByte
impl BMByte
sourcepub fn from<T: BMByteSearchable>(pattern: T) -> Option<BMByte>
pub fn from<T: BMByteSearchable>(pattern: T) -> Option<BMByte>
Create a BMByte
instance from a pattern (the needle).
use boyer_moore_magiclen::BMByte;
let bmb = BMByte::from("oocoo").unwrap();
source§impl BMByte
impl BMByte
sourcepub fn find_full_all_in<T: BMByteSearchable>(&self, text: T) -> Vec<usize>
pub fn find_full_all_in<T: BMByteSearchable>(&self, text: T) -> Vec<usize>
Find and return the positions of all matched sub-sequences in any text (the haystack).
use boyer_moore_magiclen::BMByte;
let bmb = BMByte::from("oocoo").unwrap();
assert_eq!(vec![1, 4, 7], bmb.find_full_all_in("coocoocoocoo"));
sourcepub fn find_full_in<T: BMByteSearchable>(
&self,
text: T,
limit: usize
) -> Vec<usize>
pub fn find_full_in<T: BMByteSearchable>( &self, text: T, limit: usize ) -> Vec<usize>
Find and return the positions of matched sub-sequences in any text (the haystack). If the limit
is set to 0
, all sub-sequences will be found.
use boyer_moore_magiclen::BMByte;
let bmb = BMByte::from("oocoo").unwrap();
assert_eq!(vec![1, 4], bmb.find_full_in("coocoocoocoo", 2));
source§impl BMByte
impl BMByte
sourcepub fn rfind_full_all_in<T: BMByteSearchable>(&self, text: T) -> Vec<usize>
pub fn rfind_full_all_in<T: BMByteSearchable>(&self, text: T) -> Vec<usize>
Find and return the positions of all matched sub-sequences in any text (the haystack) from its tail to its head.
use boyer_moore_magiclen::BMByte;
let bmb = BMByte::from("oocoo").unwrap();
assert_eq!(vec![7, 4, 1], bmb.rfind_full_all_in("coocoocoocoo"));
sourcepub fn rfind_full_in<T: BMByteSearchable>(
&self,
text: T,
limit: usize
) -> Vec<usize>
pub fn rfind_full_in<T: BMByteSearchable>( &self, text: T, limit: usize ) -> Vec<usize>
Find and return the positions of matched sub-sequences in any text (the haystack) from its tail to its head. If the limit
is set to 0
, all sub-sequences will be found.
use boyer_moore_magiclen::BMByte;
let bmb = BMByte::from("oocoo").unwrap();
assert_eq!(vec![7, 4], bmb.rfind_full_in("coocoocoocoo", 2));
source§impl BMByte
impl BMByte
sourcepub fn find_all_in<T: BMByteSearchable>(&self, text: T) -> Vec<usize>
pub fn find_all_in<T: BMByteSearchable>(&self, text: T) -> Vec<usize>
Find and return the positions of all matched sub-sequences in any text (the haystack) but not including the overlap.
use boyer_moore_magiclen::BMByte;
let bmb = BMByte::from("oocoo").unwrap();
assert_eq!(vec![1, 7], bmb.find_all_in("coocoocoocoo"));
sourcepub fn find_first_in<T: BMByteSearchable>(&self, text: T) -> Option<usize>
pub fn find_first_in<T: BMByteSearchable>(&self, text: T) -> Option<usize>
Find and return the position of the first matched sub-sequence in any text (the haystack).
use boyer_moore_magiclen::BMByte;
let bmb = BMByte::from("oocoo").unwrap();
assert_eq!(Some(1), bmb.find_first_in("coocoocoocoo"));
sourcepub fn find_in<T: BMByteSearchable>(&self, text: T, limit: usize) -> Vec<usize>
pub fn find_in<T: BMByteSearchable>(&self, text: T, limit: usize) -> Vec<usize>
Find and return the positions of matched sub-sequences in any text (the haystack) but not including the overlap. If the limit
is set to 0
, all sub-sequences will be found.
use boyer_moore_magiclen::BMByte;
let bmb = BMByte::from("oocoo").unwrap();
assert_eq!(vec![1], bmb.find_in("coocoocoocoo", 1));
source§impl BMByte
impl BMByte
sourcepub fn rfind_all_in<T: BMByteSearchable>(&self, text: T) -> Vec<usize>
pub fn rfind_all_in<T: BMByteSearchable>(&self, text: T) -> Vec<usize>
Find and return the positions of all matched sub-sequences in any text (the haystack) but not including the overlap from its tail to its head.
use boyer_moore_magiclen::BMByte;
let bmb = BMByte::from("oocoo").unwrap();
assert_eq!(vec![7, 1], bmb.rfind_all_in("coocoocoocoo"));
sourcepub fn rfind_first_in<T: BMByteSearchable>(&self, text: T) -> Option<usize>
pub fn rfind_first_in<T: BMByteSearchable>(&self, text: T) -> Option<usize>
Find and return the position of the first matched sub-sequence in any text (the haystack) from its tail to its head.
use boyer_moore_magiclen::BMByte;
let bmb = BMByte::from("oocoo").unwrap();
assert_eq!(Some(7), bmb.rfind_first_in("coocoocoocoo"));
sourcepub fn rfind_in<T: BMByteSearchable>(&self, text: T, limit: usize) -> Vec<usize>
pub fn rfind_in<T: BMByteSearchable>(&self, text: T, limit: usize) -> Vec<usize>
Find and return the positions of matched sub-sequences in any text (the haystack) but not including the overlap from its tail to its head. If the limit
is set to 0
, all sub-sequences will be found.
use boyer_moore_magiclen::BMByte;
let bmb = BMByte::from("oocoo").unwrap();
assert_eq!(vec![7], bmb.rfind_in("coocoocoocoo", 1));