Skip to main content

ScannerBuilder

Struct ScannerBuilder 

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

Builder for configuring a Scanner.

§Examples

use cloakrs_core::{Locale, Scanner};

let scanner = Scanner::builder().locale(Locale::US).build();
assert!(scanner.is_err());

Implementations§

Source§

impl ScannerBuilder

Source

pub fn new() -> Self

Creates a scanner builder.

Source

pub fn from_registry(registry: RecognizerRegistry) -> Self

Creates a scanner builder from an existing recognizer registry.

Source

pub fn locale(self, locale: Locale) -> Self

Sets the scanner locale.

Source

pub fn strategy(self, strategy: MaskStrategy) -> Self

Sets the masking strategy.

Source

pub fn without_masking(self) -> Self

Disables masked text generation.

Source

pub fn recognizer<R>(self, recognizer: R) -> Self
where R: Recognizer + 'static,

Adds a recognizer.

Source

pub fn boxed_recognizer(self, recognizer: Box<dyn Recognizer>) -> Self

Adds a boxed recognizer.

Source

pub fn min_confidence(self, confidence: f64) -> Result<Self>

Sets the minimum confidence threshold.

Source

pub fn build(self) -> Result<Scanner>

Builds a scanner.

Trait Implementations§

Source§

impl Default for ScannerBuilder

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.