pub struct PasswordGenerator { /* private fields */ }
Expand description

Describes a password generator. Wrapper around a ThreadRng so it’s cached to improve performance when generating random characters. Dictionary also loaded when instantiated so it doesn’t have to be called multiple times.

Implementations

Initialises a new PasswordGenerator, instantiating the ThreadRng and dictionary

Example
use password_gen::PasswordGenerator;
let generator = PasswordGenerator::new();

Generates a random password that match the given requirements.

Example
use password_gen::{PasswordOptions, PasswordGenerator};
use password_gen::password_options::CharSet;
let mut generator = PasswordGenerator::new();
let options = PasswordOptions::new(15, CharSet::Ascii);
let password = generator.generate_password(&options);

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.