Skip to main content

ScrubConfig

Struct ScrubConfig 

Source
pub struct ScrubConfig {
    pub normalize_newlines: bool,
    pub remove_zero_width: bool,
    pub remove_bidi_controls: bool,
    pub collapse_whitespace: bool,
    pub normalization: ScrubNormalization,
    pub case: ScrubCase,
    pub strip_diacritics: bool,
}
Expand description

Policy/config for constructing normalized keys / comparison forms.

The intent is to make the pipeline explicit: most real bugs here are from implicitly normalizing and accidentally destroying semantics (ZWJ/ZWNJ, bidi marks, punctuation, newlines).

Fields§

§normalize_newlines: bool

Normalize newlines (\r\n/\r\n) before any other whitespace policy.

§remove_zero_width: bool

Remove common zero-width characters (ZWSP/ZWNJ/ZWJ/WORD JOINER/BOM).

§remove_bidi_controls: bool

Remove Unicode bidirectional control characters (Trojan Source-style).

§collapse_whitespace: bool

Collapse all Unicode whitespace to single ASCII spaces (and trim).

§normalization: ScrubNormalization

Which normalization form to apply before case/diacritics.

§case: ScrubCase

Case handling strategy.

§strip_diacritics: bool

Strip combining marks (diacritics) after normalization + case mapping.

Implementations§

Source§

impl ScrubConfig

Source

pub fn search_key() -> Self

See search_key() (fallback when casefold is disabled).

Source

pub fn search_key_strict_invisibles() -> Self

Like search_key(), but also removes common zero-width characters (ZWSP/ZWNJ/ZWJ/WJ/BOM).

This is a deliberate trade-off:

  • Pro: avoids “ghost mismatches” in mostly-Latin corpora where ZWJ/ZWNJ are usually artifacts (copy/paste, rich text) rather than orthographic intent.
  • Con: ZWJ/ZWNJ are semantically meaningful in multiple scripts (and for emoji ZWJ sequences). Stripping can create false positives/negatives depending on the task.

Trait Implementations§

Source§

impl Clone for ScrubConfig

Source§

fn clone(&self) -> ScrubConfig

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 ScrubConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ScrubConfig

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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.