pub struct PasswordPolicyBuilder { /* private fields */ }Expand description
Fluent builder for PasswordPolicy.
§Example
use auth_framework::utils::validation::PasswordPolicy;
let policy = PasswordPolicy::builder()
.min_length(10)
.require_special(false)
.min_entropy(3.5)
.build();
assert_eq!(policy.min_length, 10);
assert!(!policy.require_special);Implementations§
Source§impl PasswordPolicyBuilder
impl PasswordPolicyBuilder
Sourcepub fn min_length(self, len: usize) -> Self
pub fn min_length(self, len: usize) -> Self
Set minimum password length.
Sourcepub fn max_length(self, len: usize) -> Self
pub fn max_length(self, len: usize) -> Self
Set maximum password length.
Sourcepub fn require_uppercase(self, require: bool) -> Self
pub fn require_uppercase(self, require: bool) -> Self
Whether to require at least one uppercase letter.
Sourcepub fn require_lowercase(self, require: bool) -> Self
pub fn require_lowercase(self, require: bool) -> Self
Whether to require at least one lowercase letter.
Sourcepub fn require_digit(self, require: bool) -> Self
pub fn require_digit(self, require: bool) -> Self
Whether to require at least one digit.
Sourcepub fn require_special(self, require: bool) -> Self
pub fn require_special(self, require: bool) -> Self
Whether to require at least one special character.
Sourcepub fn min_entropy(self, entropy: f64) -> Self
pub fn min_entropy(self, entropy: f64) -> Self
Set the minimum entropy threshold.
Sourcepub fn build(self) -> PasswordPolicy
pub fn build(self) -> PasswordPolicy
Consume the builder and produce the policy.
Trait Implementations§
Source§impl Clone for PasswordPolicyBuilder
impl Clone for PasswordPolicyBuilder
Source§fn clone(&self) -> PasswordPolicyBuilder
fn clone(&self) -> PasswordPolicyBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PasswordPolicyBuilder
impl RefUnwindSafe for PasswordPolicyBuilder
impl Send for PasswordPolicyBuilder
impl Sync for PasswordPolicyBuilder
impl Unpin for PasswordPolicyBuilder
impl UnsafeUnpin for PasswordPolicyBuilder
impl UnwindSafe for PasswordPolicyBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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