Struct yapg::PasswordGenerator [−][src]
Encapsulates RNG and set of characters. See crate documentation for more.
Implementations
impl PasswordGenerator
[src]
pub fn new(charset: Vec<char>, length: usize) -> Self
[src]
Creates the PasswordGenerator
to yield passwords using either
PasswordGenerator::generate
or PasswordGenerator::generate_n
charset
will not be deduplicated, so that you could (but should not!)
increase the the probability density of the chars in the generated
passwords.
pub fn length(self, length: usize) -> Self
[src]
Changes the length of the generated passwords, consumes and returns itself.
pub fn generate(&mut self) -> String
[src]
Generates one password, with characters randomly chosen from the charset.
pub fn generate_n(&mut self, n: usize) -> Vec<String>
[src]
Generates a vector of passwords with length n, calling
PasswordGenerator::generate
internally.
Cannot return an iterator, because that iterator would need to hold
a mutable reference to the generator.
pub fn combinations(&self) -> f64
[src]
Number of all possible combinations arising from charset and length.
pub fn entropy(&self) -> usize
[src]
Entropy of the generated passwords in bits.
Trait Implementations
impl Debug for PasswordGenerator
[src]
impl From<&'_ str> for PasswordGenerator
[src]
fn from(charset: &str) -> PasswordGenerator
[src]
impl From<Vec<char, Global>> for PasswordGenerator
[src]
fn from(charset: Vec<char>) -> PasswordGenerator
[src]
Auto Trait Implementations
impl !RefUnwindSafe for PasswordGenerator
impl !Send for PasswordGenerator
impl !Sync for PasswordGenerator
impl Unpin for PasswordGenerator
impl !UnwindSafe for PasswordGenerator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,