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

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

The number of words the passphrase will consist of.

A provider random passphrase words can be obtained from.

The separator string to use between passphrase words.

Whether to capitalize the first characters of words.

Whether to capitalize whole words.

Trait Implementations

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

Formats the value using the given formatter. Read more

impl Default for BasicConfig<WordSampler>
[src]

Build a default basic configuration instance.

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

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

Important traits for Scheme

Build a password scheme based on configuration in this object.

Auto Trait Implementations

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

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