Skip to main content

PassPolicy

Struct PassPolicy 

Source
pub struct PassPolicy {
    pub min_len: usize,
    pub min_char_classes: usize,
}
Expand description

Representation of passphrase policies.

Fields§

§min_len: usize

Minimum passphrase length.

§min_char_classes: usize

Minimum number of passphrase character classes.

PaaPolicy recognized the following character classes:

  • Lower case letters (a-z)
  • Upper case letters (A-Z)
  • Numeric digits (0-9)
  • Special characters (anything else)

Implementations§

Source§

impl PassPolicy

Source

pub const fn none() -> Self

Source

pub const fn strong() -> Self

Source§

impl PassPolicy

Source

pub fn spec(&self) -> String

Source

pub fn validate(&self, pass: &str) -> Result<(), String>

Validate a passphrase against policy settings.

§Errors

Returns a String describing the constraint violation.

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

Source§

fn len(&self) -> usize

The number of items that this chain link consists of.
Source§

fn append_to(self, v: &mut Vec<T>)

Append the elements in this link to the chain.
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> PipeIf for T

Source§

fn pipe_if<F>(self, predicate: bool, f: F) -> Self
where F: FnOnce(Self) -> Self,

Pipe a value through a closure if predicate is true.
Source§

fn pipe_opt<T, F>(self, opt: Option<T>, f: F) -> Self
where F: FnOnce(Self, T) -> Self,

Optionally pipe a value through a closure.
Source§

fn pipe_optref<T, F>(self, opt: Option<&T>, f: F) -> Self
where F: FnOnce(Self, &T) -> Self,

Optionally pipe a reference to a value through a closure.
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.
Source§

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

Source§

fn vzip(self) -> V