[][src]Struct chbs::config::BasicConfig

pub struct BasicConfig<P> where
    P: WordProvider
{ pub words: usize, pub word_provider: P, pub separator: String, pub capitalize_first: Probability, pub capitalize_words: Probability, }

A simple passphrase configuration struct.

This struct provides basic passphrase generation options for simple passphrases. When the struct is configured, a Scheme may be created based on it to actually generate passphrases.

Examples

Use the default basic configuration, and change the separator. Then build a scheme, and generate a passphrase.

extern crate chbs;
use chbs::{config::BasicConfig, prelude::*};

// Define the configuration
let mut config = BasicConfig::default();
config.separator = "-".into();

// Build the scheme for generation
let mut scheme = config.to_scheme();

// Generate and output
println!("Passphrase: {}", scheme.generate());

Or use the BasicConfigBuilder instead for a builder pattern:

// TODO: fix this example
// extern crate chbs;
// use chbs::{config::*, word::WordSampler};
//
// let config = BasicConfigBuilder::default()
//     .separator("-")
//     .build()
//     .unwrap();

Fields

words: usize

The number of words the passphrase will consist of.

word_provider: P

A provider random passphrase words can be obtained from.

separator: String

The separator string to use between passphrase words.

capitalize_first: Probability

Whether to capitalize the first characters of words.

capitalize_words: Probability

Whether to capitalize whole words.

Trait Implementations

impl<P> ToScheme for BasicConfig<P> where
    P: WordProvider + 'static, 
[src]

impl Default for BasicConfig<WordSampler>[src]

fn default() -> BasicConfig<WordSampler>[src]

Build a default basic configuration instance.

This configuration uses the defaul wordlist as word provider for generating passphrases.

impl<P: Clone> Clone for BasicConfig<P> where
    P: WordProvider
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl<P: Debug> Debug for BasicConfig<P> where
    P: WordProvider
[src]

Auto Trait Implementations

impl<P> Send for BasicConfig<P> where
    P: Send

impl<P> Sync for BasicConfig<P> where
    P: Sync

Blanket Implementations

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.