Struct yapg::PasswordGenerator[][src]

pub struct PasswordGenerator { /* fields omitted */ }

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]

impl From<Vec<char, Global>> for PasswordGenerator[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.