Struct aho_corasick::AcAutomaton [] [src]

pub struct AcAutomaton<P, T = Dense> {
    // some 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: AsRef<[u8]>> AcAutomaton<P>

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.

impl<P: AsRef<[u8]>, T: Transitions> AcAutomaton<P, T>

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.

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: AsRef<[u8]>, T: Transitions> Automaton<P> for AcAutomaton<P, T>

fn next_state(&self, si: StateIdx, b: u8) -> StateIdx

fn get_match(&self, si: StateIdx, outi: usize, texti: usize) -> Match

fn has_match(&self, si: StateIdx, outi: usize) -> bool

fn skip_to(&self, si: StateIdx, text: &[u8], at: usize) -> usize

fn is_skippable(&self) -> bool

fn patterns(&self) -> &[P]

fn pattern(&self, i: usize) -> &P

fn len(&self) -> usize

fn is_empty(&self) -> bool

fn find<'a, 's>(&'a self, s: &'s str) -> Matches<'a, 's, P, Self>

fn find_overlapping<'a, 's>(&'a self, s: &'s str) -> MatchesOverlapping<'a, 's, P, Self>

fn stream_find<'a, R: Read>(&'a self, rdr: R) -> StreamMatches<'a, R, P, Self>

fn stream_find_overlapping<'a, R: Read>(&'a self, rdr: R) -> StreamMatchesOverlapping<'a, R, P, Self>

impl<S: AsRef<[u8]>> FromIterator<S> for AcAutomaton<S>

fn from_iter<T>(it: T) -> AcAutomaton<S> where T: IntoIterator<Item=S>

impl<P: AsRef<[u8]> + Debug, T: Transitions> Debug for AcAutomaton<P, T>

fn fmt(&self, f: &mut Formatter) -> Result

Derived Implementations

impl<P: Clone, T: Clone> Clone for AcAutomaton<P, T> where P: Clone, T: Clone

fn clone(&self) -> AcAutomaton<P, T>

fn clone_from(&mut self, source: &Self)