Struct WuManber

Source
pub struct WuManber { /* private fields */ }
Expand description

Re-export for backward compatibility High-performance Wu-Manber multi-pattern matching algorithm Optimized for Chinese text processing with parallel table building and memory efficiency

Implementations§

Source§

impl WuManber

Source

pub fn new_chinese(patterns: Vec<String>) -> Self

Create new instance optimized for Chinese characters

Source

pub fn new(patterns: Vec<String>, block_size: usize) -> Self

Create new instance with custom block size

Source

pub fn new_parallel(patterns: Vec<String>, block_size: usize) -> Self

Create new instance with parallel table building

Source

pub fn new_with_space_handling( patterns: Vec<String>, space_handling: SpaceHandling, ) -> Self

Create new instance with space handling strategy

Source

pub fn new_with_block_size_and_space_handling( patterns: Vec<String>, block_size: usize, space_handling: SpaceHandling, ) -> Self

Create new instance with custom block size and space handling

Source

pub fn new_parallel_with_space_handling( patterns: Vec<String>, block_size: usize, space_handling: SpaceHandling, ) -> Self

Create new instance with parallel table building and space handling

Source

pub fn search(&self, text: &str) -> Option<Arc<String>>

Search for first match using Wu-Manber algorithm with space handling

Source

pub fn search_string(&self, text: &str) -> Option<String>

Legacy search method for string compatibility

Source

pub fn search_all(&self, text: &str) -> Vec<Arc<String>>

Find all matches in text with space handling

Source

pub fn search_all_strings(&self, text: &str) -> Vec<String>

Find all matches returning strings for compatibility

Source

pub fn replace_all(&self, text: &str, replacement: char) -> String

Replace all matches with replacement character

Source

pub fn remove_all(&self, text: &str) -> String

Remove all matches from text

Source

pub fn find_matches(&self, text: &str) -> Vec<Match>

Find all match positions with byte offsets

Source

pub fn patterns(&self) -> &[Arc<String>]

Get patterns reference (returns Arc slice)

Source

pub fn patterns_strings(&self) -> Vec<String>

Get original patterns as strings

Source

pub fn contains_pattern(&self, pattern: &str) -> bool

Check if pattern exists (使用 pattern_set 提供 O(1) 查找)

Source

pub fn space_handling(&self) -> SpaceHandling

Get space handling strategy

Source

pub fn memory_stats(&self) -> WuManberMemoryStats

Get memory usage statistics

Source

pub fn stats(&self) -> WuManberStats

Get statistics

Trait Implementations§

Source§

impl Clone for WuManber

Source§

fn clone(&self) -> WuManber

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for WuManber

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.