[−][src]Struct chbs::config::BasicConfig
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]
P: WordProvider + 'static,
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]
P: WordProvider,
fn clone(&self) -> BasicConfig<P>
[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]
P: WordProvider,
Auto Trait Implementations
impl<P> Send for BasicConfig<P> where
P: Send,
P: Send,
impl<P> Sync for BasicConfig<P> where
P: Sync,
P: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,