Trait aho_corasick::Automaton
source · pub trait Automaton<P> {
fn next_state(&self, si: StateIdx, b: u8) -> StateIdx;
fn has_match(&self, si: StateIdx, outi: usize) -> bool;
fn get_match(&self, si: StateIdx, outi: usize, texti: usize) -> Match;
fn start_bytes(&self) -> &[u8] ⓘ;
fn patterns(&self) -> &[P] ⓘ;
fn pattern(&self, i: usize) -> &P;
fn len(&self) -> usize { ... }
fn is_empty(&self) -> bool { ... }
fn find<'a, 's, Q: ?Sized + AsRef<[u8]>>(
&'a self,
s: &'s Q
) -> Matches<'a, 's, P, Self> ⓘ
where
Self: Sized,
{ ... }
fn find_overlapping<'a, 's, Q: ?Sized + AsRef<[u8]>>(
&'a self,
s: &'s Q
) -> MatchesOverlapping<'a, 's, P, Self> ⓘ
where
Self: Sized,
{ ... }
fn stream_find<'a, R: Read>(
&'a self,
rdr: R
) -> StreamMatches<'a, R, P, Self> ⓘ
where
Self: Sized,
{ ... }
fn stream_find_overlapping<'a, R: Read>(
&'a self,
rdr: R
) -> StreamMatchesOverlapping<'a, R, P, Self> ⓘ
where
Self: Sized,
{ ... }
}
Expand description
An abstraction over automatons and their corresponding iterators.
The type parameter P
is the type of the pattern that was used to
construct this Automaton.
Required Methods§
sourcefn next_state(&self, si: StateIdx, b: u8) -> StateIdx
fn next_state(&self, si: StateIdx, b: u8) -> StateIdx
Return the next state given the current state and next character.
sourcefn has_match(&self, si: StateIdx, outi: usize) -> bool
fn has_match(&self, si: StateIdx, outi: usize) -> bool
Return true if and only if the given state and current pattern index indicate a match.
sourcefn get_match(&self, si: StateIdx, outi: usize, texti: usize) -> Match
fn get_match(&self, si: StateIdx, outi: usize, texti: usize) -> Match
Build a match given the current state, pattern index and input index.
sourcefn start_bytes(&self) -> &[u8] ⓘ
fn start_bytes(&self) -> &[u8] ⓘ
Return the set of bytes that have transitions in the root state.
Provided Methods§
sourcefn find<'a, 's, Q: ?Sized + AsRef<[u8]>>(
&'a self,
s: &'s Q
) -> Matches<'a, 's, P, Self> ⓘwhere
Self: Sized,
fn find<'a, 's, Q: ?Sized + AsRef<[u8]>>(
&'a self,
s: &'s Q
) -> Matches<'a, 's, P, Self> ⓘwhere
Self: Sized,
Returns an iterator of non-overlapping matches in s
.
sourcefn find_overlapping<'a, 's, Q: ?Sized + AsRef<[u8]>>(
&'a self,
s: &'s Q
) -> MatchesOverlapping<'a, 's, P, Self> ⓘwhere
Self: Sized,
fn find_overlapping<'a, 's, Q: ?Sized + AsRef<[u8]>>(
&'a self,
s: &'s Q
) -> MatchesOverlapping<'a, 's, P, Self> ⓘwhere
Self: Sized,
Returns an iterator of overlapping matches in s
.
sourcefn stream_find<'a, R: Read>(&'a self, rdr: R) -> StreamMatches<'a, R, P, Self> ⓘwhere
Self: Sized,
fn stream_find<'a, R: Read>(&'a self, rdr: R) -> StreamMatches<'a, R, P, Self> ⓘwhere
Self: Sized,
Returns an iterator of non-overlapping matches in the given reader.
sourcefn stream_find_overlapping<'a, R: Read>(
&'a self,
rdr: R
) -> StreamMatchesOverlapping<'a, R, P, Self> ⓘwhere
Self: Sized,
fn stream_find_overlapping<'a, R: Read>(
&'a self,
rdr: R
) -> StreamMatchesOverlapping<'a, R, P, Self> ⓘwhere
Self: Sized,
Returns an iterator of overlapping matches in the given reader.