pub struct PasswordGenerator {
pub length: usize,
pub numbers: bool,
pub lowercase_letters: bool,
pub uppercase_letters: bool,
pub symbols: bool,
pub spaces: bool,
pub exclude_similar_characters: bool,
pub strict: bool,
}
Expand description
This struct can help you generate passwords.
Fields§
§length: usize
The length of the generated passwords.
Default: 8
numbers: bool
Passwords are allowed to, or must if the strict is true, contain a number or numbers.
Default: true
lowercase_letters: bool
Passwords are allowed to, or must if the strict is true, contain a lowercase letter or lowercase letters.
Default: true
uppercase_letters: bool
Passwords are allowed to, or must if the strict is true, contain an uppercase letter or uppercase letters.
Default: false
symbols: bool
Passwords are allowed to, or must if the strict is true, contain a symbol or symbols.
Default: false
spaces: bool
Passwords are allowed to, or must if the strict is true, contain a space or spaces.
Default: false
exclude_similar_characters: bool
Whether to exclude similar characters, iI1loO0"'`|
.
Default: false
strict: bool
Whether the password rules are strict.
Default: false
Implementations§
Source§impl PasswordGenerator
impl PasswordGenerator
Sourcepub const fn new() -> PasswordGenerator
pub const fn new() -> PasswordGenerator
Create a PasswordGenerator
instance.
PasswordGenerator {
length: 8,
numbers: true,
lowercase_letters: true,
uppercase_letters: false,
symbols: false,
spaces: false,
exclude_similar_characters: false,
strict: false,
}
Sourcepub const fn length(self, length: usize) -> PasswordGenerator
pub const fn length(self, length: usize) -> PasswordGenerator
The length of the generated passwords.
Sourcepub const fn numbers(self, numbers: bool) -> PasswordGenerator
pub const fn numbers(self, numbers: bool) -> PasswordGenerator
Passwords are allowed to, or must if the strict is true, contain a number or numbers.
Sourcepub const fn lowercase_letters(
self,
lowercase_letters: bool,
) -> PasswordGenerator
pub const fn lowercase_letters( self, lowercase_letters: bool, ) -> PasswordGenerator
Passwords are allowed to, or must if the strict is true, contain a lowercase letter or lowercase letters.
Sourcepub const fn uppercase_letters(
self,
uppercase_letters: bool,
) -> PasswordGenerator
pub const fn uppercase_letters( self, uppercase_letters: bool, ) -> PasswordGenerator
Passwords are allowed to, or must if the strict is true, contain an uppercase letter or uppercase letters.
Sourcepub const fn symbols(self, symbols: bool) -> PasswordGenerator
pub const fn symbols(self, symbols: bool) -> PasswordGenerator
Passwords are allowed to, or must if the strict is true, contain a symbol or symbols.
Sourcepub const fn spaces(self, space: bool) -> PasswordGenerator
pub const fn spaces(self, space: bool) -> PasswordGenerator
Passwords are allowed to, or must if the strict is true, contain a space or spaces.
Sourcepub const fn exclude_similar_characters(
self,
exclude_similar_characters: bool,
) -> PasswordGenerator
pub const fn exclude_similar_characters( self, exclude_similar_characters: bool, ) -> PasswordGenerator
Whether to exclude similar characters? The excluded similar characters set is iI1loO0"'`|
.
Sourcepub const fn strict(self, strict: bool) -> PasswordGenerator
pub const fn strict(self, strict: bool) -> PasswordGenerator
Whether the password rules are strict.
Trait Implementations§
Source§impl Clone for PasswordGenerator
impl Clone for PasswordGenerator
Source§fn clone(&self) -> PasswordGenerator
fn clone(&self) -> PasswordGenerator
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more