Struct Passgen

Source
pub struct Passgen {
    pub enab_letters: bool,
    pub enab_u_letters: bool,
    pub enab_num: bool,
    pub enab_spec_symbs: bool,
    pub enab_strong_usab: bool,
    pub custom_charset: &'static str,
}
Expand description

Main Passgen structure.

§Examples

You can create a token that includes lowercase letters and numbers up to 30 characters long:

use passgenlib::Passgen;
let result = Passgen::new().set_enabled_letters(true).set_enabled_numbers(true).generate(30);

You can create a default strong password including all literals, numbers and symbols:

use passgenlib::Passgen;
let result = Passgen::default().generate(12);

You can create a strong and usability password. Including all characters, but the first position in the password is a capital or small letter, the last position is the symbol. 🔸 Excluded ambiguous characters "0oOiIlL1".

use passgenlib::Passgen;
let result = Passgen::default_strong_and_usab().generate(8);

You can create a set from your custom charset:

use passgenlib::Passgen;
let result = Passgen::new().set_custom_charset("bla@.321").generate(8);

Fields§

§enab_letters: bool

Presence of letters.

§enab_u_letters: bool

Presence of a capital letters.

§enab_num: bool

Presence of numeric characters.

§enab_spec_symbs: bool

Presence of special characters.

§enab_strong_usab: bool

Including all characters, but the first position in the password is a capital or small letter, the last position is the symbol. Excluded ambiguous characters "0oOiIlL1".

⚠️ If this rule is enabled, the other consistency rules of the generating are not taken, except for a rule custom_charset.

§custom_charset: &'static str

User defined character set.

⚠️This set of characters will exclude all other rules except for a rule "enab_strong_usab".

⚙️If "enab_strong_usab" on too then you can generate combined strong and usability result with custom charset.

Implementations§

Source§

impl Passgen

Source

pub fn new() -> Passgen

Get an instance of Passgen without any rules.

Source

pub fn default() -> Passgen

Set default ruleset of Passgen to “all simple rules are enabled”.

Source

pub fn default_strong_and_usab() -> Passgen

Set default ruleset of Passgen to “Strong & usability”.

Including all characters, but the first position in the password is a capital or small letter, the last position is the symbol. Excluded ambiguous characters "0oOiIlL1".

⚠️ If this rule is enabled, the other consistency rules of the generating are not taken, except for a rule custom_charset.

Source

pub fn set_enabled_letters(&mut self, value: bool) -> &mut Passgen

Set value of the field enab_letters for Passgen.

Source

pub fn set_enabled_uppercase_letters(&mut self, value: bool) -> &mut Passgen

Set value of the field enab_u_letters for Passgen.

Source

pub fn set_enabled_numbers(&mut self, value: bool) -> &mut Passgen

Set value of the field enab_num for Passgen.

Source

pub fn set_enabled_spec_symbols(&mut self, value: bool) -> &mut Passgen

Set value of the field enab_spec_symbs for Passgen.

Source

pub fn set_enabled_strong_usab(&mut self, value: bool) -> &mut Passgen

Set value of the field enab_strong_usab for Passgen.

Including all characters, but the first position in the password is a capital or small letter, the last position is the symbol. Excluded ambiguous characters "0oOiIlL1".

⚠️ If this rule is enabled, the other consistency rules of the generating are not taken, except for a rule custom_charset.

Source

pub fn set_custom_charset(&mut self, value: &'static str) -> &mut Passgen

Set user defined character set. You can use any Unicode characters and emoji. For example: abcABC123⭕➖❎⚫⬛n₼⁂🙂

⚠️This set of characters will exclude all other rules except for a rule "enab_strong_usab".

⚙️If "enab_strong_usab" on too then you can generate combined strong and usability result with custom charset.

Source

pub fn generate(&mut self, length: u32) -> String

Generate result. Argument “length” will not be less than 4

Auto Trait Implementations§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V