Struct Builder

pub struct Builder { /* private fields */ }

A builder for configuring an Aho-Corasick DFA.

This builder has a subset of the options available to a AhoCorasickBuilder. Of the shared options, their behavior is identical.

Implementations

impl Builder

fn new() -> Builder

Create a new builder for configuring an Aho-Corasick DFA.

fn build<I, P>(&self, patterns: I) -> Result<DFA, BuildError>
where
    I: IntoIterator<Item = P>,
    P: AsRef<[u8]>,

Build an Aho-Corasick DFA from the given iterator of patterns.

A builder may be reused to create more DFAs.

fn build_from_noncontiguous(&self, nnfa: &NFA) -> Result<DFA, BuildError>

Build an Aho-Corasick DFA from the given noncontiguous NFA.

Note that when this method is used, only the start_kind and byte_classes settings on this builder are respected. The other settings only apply to the initial construction of the Aho-Corasick automaton. Since using this method requires that initial construction has already completed, all settings impacting only initial construction are no longer relevant.

fn match_kind(&mut self, kind: MatchKind) -> &mut Builder

Set the desired match semantics.

This only applies when using Builder::build and not Builder::build_from_noncontiguous.

See AhoCorasickBuilder::match_kind for more documentation and examples.

fn ascii_case_insensitive(&mut self, yes: bool) -> &mut Builder

Enable ASCII-aware case insensitive matching.

This only applies when using Builder::build and not Builder::build_from_noncontiguous.

See AhoCorasickBuilder::ascii_case_insensitive for more documentation and examples.

fn prefilter(&mut self, yes: bool) -> &mut Builder

Enable heuristic prefilter optimizations.

This only applies when using Builder::build and not Builder::build_from_noncontiguous.

See AhoCorasickBuilder::prefilter for more documentation and examples.

fn start_kind(&mut self, kind: StartKind) -> &mut Builder

Sets the starting state configuration for the automaton.

See AhoCorasickBuilder::start_kind for more documentation and examples.

fn byte_classes(&mut self, yes: bool) -> &mut Builder

A debug setting for whether to attempt to shrink the size of the automaton's alphabet or not.

This should never be enabled unless you're debugging an automaton. Namely, disabling byte classes makes transitions easier to reason about, since they use the actual bytes instead of equivalence classes. Disabling this confers no performance benefit at search time.

See AhoCorasickBuilder::byte_classes for more documentation and examples.

Trait Implementations

impl Clone for Builder

fn clone(&self) -> Self

impl Debug for Builder

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

impl Default for Builder

fn default() -> Builder

Auto Trait Implementations

impl Freeze for Builder

impl RefUnwindSafe for Builder

impl Send for Builder

impl Sync for Builder

impl Unpin for Builder

impl UnsafeUnpin for Builder

impl UnwindSafe for Builder

Blanket Implementations

impl<T> Any for Builder where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Builder where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Builder where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for Builder where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Builder

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Builder where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Builder where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Builder where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Builder where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>