Struct aho_corasick::packed::Config
source · [−]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
sourceimpl Config
impl Config
sourcepub fn new() -> Config
pub fn new() -> Config
Create a new default configuration. A default configuration uses leftmost-first match semantics.
sourcepub fn builder(&self) -> Builder
pub fn builder(&self) -> Builder
Create a packed builder from this configuration. The builder can be
used to accumulate patterns and create a
Searcher
from them.
sourcepub fn match_kind(&mut self, kind: MatchKind) -> &mut Config
pub fn match_kind(&mut self, kind: MatchKind) -> &mut Config
Set the match semantics for this configuration.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more