Struct aho_corasick::AcAutomaton
source · pub struct AcAutomaton<P, T = Dense> { /* private fields */ }
Expand description
An Aho-Corasick finite automaton.
The type parameter P
is the type of the pattern that was used to
construct this AcAutomaton.
Implementations§
source§impl<P: AsRef<[u8]>> AcAutomaton<P>
impl<P: AsRef<[u8]>> AcAutomaton<P>
sourcepub fn new<I>(pats: I) -> AcAutomaton<P, Dense>where
I: IntoIterator<Item = P>,
pub fn new<I>(pats: I) -> AcAutomaton<P, Dense>where
I: IntoIterator<Item = P>,
Create a new automaton from an iterator of patterns.
The patterns must be convertible to bytes (&[u8]
) via the AsRef
trait.
source§impl<P: AsRef<[u8]>, T: Transitions> AcAutomaton<P, T>
impl<P: AsRef<[u8]>, T: Transitions> AcAutomaton<P, T>
sourcepub fn with_transitions<I>(pats: I) -> AcAutomaton<P, T>where
I: IntoIterator<Item = P>,
pub fn with_transitions<I>(pats: I) -> AcAutomaton<P, T>where
I: IntoIterator<Item = P>,
Create a new automaton from an iterator of patterns.
This constructor allows one to choose the transition representation.
The patterns must be convertible to bytes (&[u8]
) via the AsRef
trait.
sourcepub fn into_full(self) -> FullAcAutomaton<P>
pub fn into_full(self) -> FullAcAutomaton<P>
Build out the entire automaton into a single matrix.
This will make searching as fast as possible at the expense of using
at least 4 * 256 * #states
bytes of memory.
Trait Implementations§
source§impl<P: AsRef<[u8]>, T: Transitions> Automaton<P> for AcAutomaton<P, T>
impl<P: AsRef<[u8]>, T: Transitions> Automaton<P> for AcAutomaton<P, T>
source§fn 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.
source§fn 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.
source§fn 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. Read more
source§fn start_bytes(&self) -> &[u8] ⓘ
fn start_bytes(&self) -> &[u8] ⓘ
Return the set of bytes that have transitions in the root state.
source§fn 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
.source§fn 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
.source§fn 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.
source§fn 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.
source§impl<P: Clone, T: Clone> Clone for AcAutomaton<P, T>
impl<P: Clone, T: Clone> Clone for AcAutomaton<P, T>
source§fn clone(&self) -> AcAutomaton<P, T>
fn clone(&self) -> AcAutomaton<P, T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<P: AsRef<[u8]> + Debug, T: Transitions> Debug for AcAutomaton<P, T>
impl<P: AsRef<[u8]> + Debug, T: Transitions> Debug for AcAutomaton<P, T>
source§impl<S: AsRef<[u8]>> FromIterator<S> for AcAutomaton<S>
impl<S: AsRef<[u8]>> FromIterator<S> for AcAutomaton<S>
source§fn from_iter<T>(it: T) -> AcAutomaton<S>where
T: IntoIterator<Item = S>,
fn from_iter<T>(it: T) -> AcAutomaton<S>where
T: IntoIterator<Item = S>,
Create an automaton from an iterator of strings.