genpass3

Struct Config

Source
pub struct Config { /* private fields */ }
Expand description

The config for the generation of passwords. Taken as an argument by the run function.

You can create an instance of this struct using Config::new or Config::build.

Implementations§

Source§

impl Config

Source

pub fn build( args: impl Iterator<Item = String>, ) -> Result<Config, Box<dyn Error>>

Creates a Config type using the command line arguments of the binary, passed in as arguments. Assumes the first iteration of args is the program name, so it’s ignored.

Parameter:

  • args - An iterator, meant to iterate over the binary’s arguments and flags.
§Errors

This function can result in an error if the length parameter could not be parsed into a usize.

Source

pub fn new(length: usize) -> Config

Creates a Config type. Recommended over Config::build for most use cases.

Parameter:

  • length - A usize to act as the length of the password.
Source

pub fn print_config()

Prints the configuration options to stderr.

§Example
Config::print_config();

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.