Struct Checker

Source
pub struct Checker<Type> {
    pub name: &'static str,
    pub description: &'static str,
    pub link: &'static str,
    pub tags: Vec<&'static str>,
    pub expected_runtime: f32,
    pub popularity: f32,
    pub lemmeknow_config: Identifier,
    pub sensitivity: Sensitivity,
    pub enhanced_detector: Option<()>,
    pub _phantom: PhantomData<Type>,
}
Expand description

Every checker is of type CheckerType This will let us pick & choose which checkers to use at runtime.

Fields§

§name: &'static str

The name of the checker

§description: &'static str

The description of the checker you can take the first line from Wikipedia Sometimes our checkers do not exist on Wikipedia so we write our own.

§link: &'static str

The link to the checker’s website Wikipedia link, articles, github etc

§tags: Vec<&'static str>

The tags of the checker

§expected_runtime: f32

The expected runtime of the checker We get this by bench marking the code

§popularity: f32

The popularity of the checker

§lemmeknow_config: Identifier

lemmeknow config object

§sensitivity: Sensitivity

The sensitivity level for gibberish detection This is only used by checkers that implement the SensitivityAware trait

§enhanced_detector: Option<()>

Enhanced gibberish detector using BERT model This is only used when enhanced detection is enabled

§_phantom: PhantomData<Type>

https://doc.rust-lang.org/std/marker/struct.PhantomData.html Let’s us save memory by telling the compiler that our type acts like a type even though it doesn’t. Stops the compiler complaining, else we’d need to implement some magic to make it work.

Trait Implementations§

Source§

impl Check for Checker<Athena>

Source§

fn new() -> Self

Returns a new struct of type CheckerType
Source§

fn check(&self, text: &str) -> CheckResult

Checks the given text to see if its plaintext
Source§

fn with_sensitivity(self, sensitivity: Sensitivity) -> Self

Sets the sensitivity level for gibberish detection
Source§

fn get_sensitivity(&self) -> Sensitivity

Gets the current sensitivity level
Source§

impl Check for Checker<DefaultChecker>

Source§

fn new() -> Self

Returns a new struct of type CheckerType
Source§

fn check(&self, _text: &str) -> CheckResult

Checks the given text to see if its plaintext
Source§

fn with_sensitivity(self, sensitivity: Sensitivity) -> Self

Sets the sensitivity level for gibberish detection
Source§

fn get_sensitivity(&self) -> Sensitivity

Gets the current sensitivity level
Source§

impl Check for Checker<EnglishChecker>

given an input, check every item in the array and return true if any of them match

Source§

fn new() -> Self

Returns a new struct of type CheckerType
Source§

fn check(&self, text: &str) -> CheckResult

Checks the given text to see if its plaintext
Source§

fn with_sensitivity(self, sensitivity: Sensitivity) -> Self

Sets the sensitivity level for gibberish detection
Source§

fn get_sensitivity(&self) -> Sensitivity

Gets the current sensitivity level
Source§

impl Check for Checker<LemmeKnow>

Source§

fn new() -> Self

Returns a new struct of type CheckerType
Source§

fn check(&self, text: &str) -> CheckResult

Checks the given text to see if its plaintext
Source§

fn with_sensitivity(self, sensitivity: Sensitivity) -> Self

Sets the sensitivity level for gibberish detection
Source§

fn get_sensitivity(&self) -> Sensitivity

Gets the current sensitivity level
Source§

impl Check for Checker<PasswordChecker>

Implementation of the Check trait for PasswordChecker

Source§

fn new() -> Self

Returns a new struct of type CheckerType
Source§

fn check(&self, text: &str) -> CheckResult

Checks the given text to see if its plaintext
Source§

fn with_sensitivity(self, sensitivity: Sensitivity) -> Self

Sets the sensitivity level for gibberish detection
Source§

fn get_sensitivity(&self) -> Sensitivity

Gets the current sensitivity level
Source§

impl Check for Checker<RegexChecker>

Source§

fn new() -> Self

Returns a new struct of type CheckerType
Source§

fn check(&self, text: &str) -> CheckResult

Checks the given text to see if its plaintext
Source§

fn with_sensitivity(self, sensitivity: Sensitivity) -> Self

Sets the sensitivity level for gibberish detection
Source§

fn get_sensitivity(&self) -> Sensitivity

Gets the current sensitivity level
Source§

impl Check for Checker<WaitAthena>

Source§

fn new() -> Self

Returns a new struct of type CheckerType
Source§

fn check(&self, text: &str) -> CheckResult

Checks the given text to see if its plaintext
Source§

fn with_sensitivity(self, sensitivity: Sensitivity) -> Self

Sets the sensitivity level for gibberish detection
Source§

fn get_sensitivity(&self) -> Sensitivity

Gets the current sensitivity level
Source§

impl Check for Checker<WordlistChecker>

Source§

fn new() -> Self

Returns a new struct of type CheckerType
Source§

fn check(&self, text: &str) -> CheckResult

Checks the given text to see if its plaintext
Source§

fn with_sensitivity(self, sensitivity: Sensitivity) -> Self

Sets the sensitivity level for gibberish detection
Source§

fn get_sensitivity(&self) -> Sensitivity

Gets the current sensitivity level

Auto Trait Implementations§

§

impl<Type> Freeze for Checker<Type>

§

impl<Type> RefUnwindSafe for Checker<Type>
where Type: RefUnwindSafe,

§

impl<Type> Send for Checker<Type>
where Type: Send,

§

impl<Type> Sync for Checker<Type>
where Type: Sync,

§

impl<Type> Unpin for Checker<Type>
where Type: Unpin,

§

impl<Type> UnwindSafe for Checker<Type>
where Type: UnwindSafe,

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,