pub struct Config { /* private fields */ }
Expand description

The configuration for a packed multiple pattern searcher.

The configuration is currently limited only to being able to select the match semantics (leftmost-first or leftmost-longest) of a searcher. In the future, more knobs may be made available.

A configuration produces a packed::Builder, which in turn can be used to construct a packed::Searcher for searching.

Example

This example shows how to use leftmost-longest semantics instead of the default (leftmost-first).

use aho_corasick::packed::{Config, MatchKind};

let searcher = Config::new()
    .match_kind(MatchKind::LeftmostLongest)
    .builder()
    .add("foo")
    .add("foobar")
    .build()?;
let matches: Vec<usize> = searcher
    .find_iter("foobar")
    .map(|mat| mat.pattern())
    .collect();
assert_eq!(vec![1], matches);

Implementations

Create a new default configuration. A default configuration uses leftmost-first match semantics.

Create a packed builder from this configuration. The builder can be used to accumulate patterns and create a Searcher from them.

Set the match semantics for this configuration.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.