Struct split_by::AcAutomaton
[−]
[src]
pub struct AcAutomaton<P, T = Dense> { /* fields omitted */ }
An Aho-Corasick finite automaton.
The type parameter P
is the type of the pattern that was used to
construct this AcAutomaton.
Methods
impl<P> AcAutomaton<P, Dense> where
P: AsRef<[u8]>,
[src]
P: AsRef<[u8]>,
fn new<I>(pats: I) -> AcAutomaton<P, Dense> where
I: IntoIterator<Item = P>,
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.
impl<P, T> AcAutomaton<P, T> where
P: AsRef<[u8]>,
T: Transitions,
[src]
P: AsRef<[u8]>,
T: Transitions,
fn with_transitions<I>(pats: I) -> AcAutomaton<P, T> where
I: IntoIterator<Item = P>,
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.
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
impl<P, T> Automaton<P> for AcAutomaton<P, T> where
P: AsRef<[u8]>,
T: Transitions,
[src]
P: AsRef<[u8]>,
T: Transitions,
fn next_state(&self, si: u32, b: u8) -> u32
Return the next state given the current state and next character.
fn get_match(&self, si: u32, outi: usize, texti: usize) -> Match
Build a match given the current state, pattern index and input index.
fn has_match(&self, si: u32, outi: usize) -> bool
Return true if and only if the given state and current pattern index indicate a match. Read more
fn start_bytes(&self) -> &[u8]
Return the set of bytes that have transitions in the root state.
fn patterns(&self) -> &[P]
Returns all of the patterns matched by this automaton. Read more
fn pattern(&self, i: usize) -> &P
Returns the pattern indexed at i
. Read more
fn len(&self) -> usize
Return the number of patterns in the automaton.
fn is_empty(&self) -> bool
Returns true if the automaton has no patterns.
fn find<Q>(&'a self, s: &'s Q) -> Matches<'a, 's, P, Self> where
Q: AsRef<[u8]> + ?Sized,
Q: AsRef<[u8]> + ?Sized,
Returns an iterator of non-overlapping matches in s
.
fn find_overlapping<Q>(
&'a self,
s: &'s Q
) -> MatchesOverlapping<'a, 's, P, Self> where
Q: AsRef<[u8]> + ?Sized,
&'a self,
s: &'s Q
) -> MatchesOverlapping<'a, 's, P, Self> where
Q: AsRef<[u8]> + ?Sized,
Returns an iterator of overlapping matches in s
.
fn stream_find<R>(&'a self, rdr: R) -> StreamMatches<'a, R, P, Self> where
R: Read,
R: Read,
Returns an iterator of non-overlapping matches in the given reader.
fn stream_find_overlapping<R>(
&'a self,
rdr: R
) -> StreamMatchesOverlapping<'a, R, P, Self> where
R: Read,
&'a self,
rdr: R
) -> StreamMatchesOverlapping<'a, R, P, Self> where
R: Read,
Returns an iterator of overlapping matches in the given reader.
impl<S> FromIterator<S> for AcAutomaton<S, Dense> where
S: AsRef<[u8]>,
[src]
S: AsRef<[u8]>,
fn from_iter<T>(it: T) -> AcAutomaton<S, Dense> where
T: IntoIterator<Item = S>,
T: IntoIterator<Item = S>,
Create an automaton from an iterator of strings.
impl<P, T> Debug for AcAutomaton<P, T> where
P: AsRef<[u8]> + Debug,
T: Transitions,
[src]
P: AsRef<[u8]> + Debug,
T: Transitions,
impl<P, T> Clone for AcAutomaton<P, T> where
P: Clone,
T: Clone,
[src]
P: Clone,
T: Clone,
fn clone(&self) -> AcAutomaton<P, T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more