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
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: Clone> Clone for BasicConfig<P> where
P: WordProvider,
[src]
impl<P: Clone> Clone for BasicConfig<P> where
P: WordProvider,
fn clone(&self) -> BasicConfig<P>
[src]
fn clone(&self) -> BasicConfig<P>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<P: Debug> Debug for BasicConfig<P> where
P: WordProvider,
[src]
impl<P: Debug> Debug for BasicConfig<P> where
P: WordProvider,
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for BasicConfig<WordSampler>
[src]
impl Default for BasicConfig<WordSampler>
fn default() -> BasicConfig<WordSampler>
[src]
fn default() -> BasicConfig<WordSampler>
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]
impl<P> ToScheme for BasicConfig<P> where
P: WordProvider + 'static,
Auto Trait Implementations
impl<P> Send for BasicConfig<P> where
P: Send,
impl<P> Send for BasicConfig<P> where
P: Send,
impl<P> Sync for BasicConfig<P> where
P: Sync,
impl<P> Sync for BasicConfig<P> where
P: Sync,