pub struct Matcher { /* private fields */ }Expand description
围绕 daachorse::DoubleArrayAhoCorasick 的简单适配器。 存储原始模式(按顺序),并提供一个辅助方法 用于获取每个模式在输入中首次出现的位置。
Implementations§
Source§impl Matcher
impl Matcher
Sourcepub fn from_patterns<S: AsRef<str>>(patterns: &[S]) -> Self
pub fn from_patterns<S: AsRef<str>>(patterns: &[S]) -> Self
从一组模式构建一个 Matcher(模式顺序重要)。 空模式会被忽略;至少需要一个非空模式。
Sourcepub fn find_first_positions(&self, haystack: &[u8]) -> Vec<Option<usize>>
pub fn find_first_positions(&self, haystack: &[u8]) -> Vec<Option<usize>>
返回一个 Vec<Option
Sourcepub fn patterns_len(&self) -> usize
pub fn patterns_len(&self) -> usize
Expose number of patterns
Auto Trait Implementations§
impl Freeze for Matcher
impl RefUnwindSafe for Matcher
impl Send for Matcher
impl Sync for Matcher
impl Unpin for Matcher
impl UnwindSafe for Matcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more