Struct lesspass::CharacterSet [−]
pub struct CharacterSet { /* fields omitted */ }
A flag that describes what characters are allowed when generating a password.
Methods
impl CharacterSet
impl CharacterSet
pub const Uppercase: CharacterSet
Uppercase: CharacterSet = CharacterSet{bits: 1,}
pub const Lowercase: CharacterSet
Lowercase: CharacterSet = CharacterSet{bits: 2,}
pub const Numbers: CharacterSet
Numbers: CharacterSet = CharacterSet{bits: 4,}
pub const Symbols: CharacterSet
Symbols: CharacterSet = CharacterSet{bits: 8,}
pub const Letters: CharacterSet
Letters: CharacterSet = CharacterSet{bits: <Self>::Uppercase.bits | <Self>::Lowercase.bits,}
pub const All: CharacterSet
All: CharacterSet = CharacterSet{bits: <Self>::Letters.bits | <Self>::Numbers.bits | <Self>::Symbols.bits,}
pub fn empty() -> CharacterSet
pub fn empty() -> CharacterSet
Returns an empty set of flags.
pub fn all() -> CharacterSet
pub fn all() -> CharacterSet
Returns the set containing all flags.
pub fn bits(&self) -> u8
pub fn bits(&self) -> u8
Returns the raw value of the flags currently stored.
pub fn from_bits(bits: u8) -> Option<CharacterSet>
pub fn from_bits(bits: u8) -> Option<CharacterSet>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
pub fn from_bits_truncate(bits: u8) -> CharacterSet
pub fn from_bits_truncate(bits: u8) -> CharacterSet
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
pub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
if no flags are currently stored.
pub fn is_all(&self) -> bool
pub fn is_all(&self) -> bool
Returns true
if all flags are currently set.
pub fn intersects(&self, other: CharacterSet) -> bool
pub fn intersects(&self, other: CharacterSet) -> bool
Returns true
if there are flags common to both self
and other
.
pub fn contains(&self, other: CharacterSet) -> bool
pub fn contains(&self, other: CharacterSet) -> bool
Returns true
all of the flags in other
are contained within self
.
pub fn insert(&mut self, other: CharacterSet)
pub fn insert(&mut self, other: CharacterSet)
Inserts the specified flags in-place.
pub fn remove(&mut self, other: CharacterSet)
pub fn remove(&mut self, other: CharacterSet)
Removes the specified flags in-place.
pub fn toggle(&mut self, other: CharacterSet)
pub fn toggle(&mut self, other: CharacterSet)
Toggles the specified flags in-place.
pub fn set(&mut self, other: CharacterSet, value: bool)
pub fn set(&mut self, other: CharacterSet, value: bool)
Inserts or removes the specified flags depending on the passed value.
impl CharacterSet
[src]
impl CharacterSet
pub fn get_characters(self) -> &'static str
[src]
pub fn get_characters(self) -> &'static str
Return a string that contains all the characters that may be used to generate a password.
pub fn get_sets(self) -> Vec<&'static str>
[src]
pub fn get_sets(self) -> Vec<&'static str>
Return a vector of all the sets of characters that may be used to generate a password.
Trait Implementations
impl Copy for CharacterSet
impl Copy for CharacterSet
impl PartialEq for CharacterSet
impl PartialEq for CharacterSet
fn eq(&self, other: &CharacterSet) -> bool
fn eq(&self, other: &CharacterSet) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &CharacterSet) -> bool
fn ne(&self, other: &CharacterSet) -> bool
This method tests for !=
.
impl Eq for CharacterSet
impl Eq for CharacterSet
impl Clone for CharacterSet
impl Clone for CharacterSet
fn clone(&self) -> CharacterSet
fn clone(&self) -> CharacterSet
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 PartialOrd for CharacterSet
impl PartialOrd for CharacterSet
fn partial_cmp(&self, other: &CharacterSet) -> Option<Ordering>
fn partial_cmp(&self, other: &CharacterSet) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &CharacterSet) -> bool
fn lt(&self, other: &CharacterSet) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &CharacterSet) -> bool
fn le(&self, other: &CharacterSet) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &CharacterSet) -> bool
fn gt(&self, other: &CharacterSet) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &CharacterSet) -> bool
fn ge(&self, other: &CharacterSet) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Ord for CharacterSet
impl Ord for CharacterSet
fn cmp(&self, other: &CharacterSet) -> Ordering
fn cmp(&self, other: &CharacterSet) -> Ordering
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl Hash for CharacterSet
impl Hash for CharacterSet
fn hash<__H: Hasher>(&self, state: &mut __H)
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for CharacterSet
impl Debug for CharacterSet
impl Binary for CharacterSet
impl Binary for CharacterSet
impl Octal for CharacterSet
impl Octal for CharacterSet
impl LowerHex for CharacterSet
impl LowerHex for CharacterSet
impl UpperHex for CharacterSet
impl UpperHex for CharacterSet
impl BitOr for CharacterSet
impl BitOr for CharacterSet
type Output = CharacterSet
The resulting type after applying the |
operator.
fn bitor(self, other: CharacterSet) -> CharacterSet
fn bitor(self, other: CharacterSet) -> CharacterSet
Returns the union of the two sets of flags.
impl BitOrAssign for CharacterSet
impl BitOrAssign for CharacterSet
fn bitor_assign(&mut self, other: CharacterSet)
fn bitor_assign(&mut self, other: CharacterSet)
Adds the set of flags.
impl BitXor for CharacterSet
impl BitXor for CharacterSet
type Output = CharacterSet
The resulting type after applying the ^
operator.
fn bitxor(self, other: CharacterSet) -> CharacterSet
fn bitxor(self, other: CharacterSet) -> CharacterSet
Returns the left flags, but with all the right flags toggled.
impl BitXorAssign for CharacterSet
impl BitXorAssign for CharacterSet
fn bitxor_assign(&mut self, other: CharacterSet)
fn bitxor_assign(&mut self, other: CharacterSet)
Toggles the set of flags.
impl BitAnd for CharacterSet
impl BitAnd for CharacterSet
type Output = CharacterSet
The resulting type after applying the &
operator.
fn bitand(self, other: CharacterSet) -> CharacterSet
fn bitand(self, other: CharacterSet) -> CharacterSet
Returns the intersection between the two sets of flags.
impl BitAndAssign for CharacterSet
impl BitAndAssign for CharacterSet
fn bitand_assign(&mut self, other: CharacterSet)
fn bitand_assign(&mut self, other: CharacterSet)
Disables all flags disabled in the set.
impl Sub for CharacterSet
impl Sub for CharacterSet
type Output = CharacterSet
The resulting type after applying the -
operator.
fn sub(self, other: CharacterSet) -> CharacterSet
fn sub(self, other: CharacterSet) -> CharacterSet
Returns the set difference of the two sets of flags.
impl SubAssign for CharacterSet
impl SubAssign for CharacterSet
fn sub_assign(&mut self, other: CharacterSet)
fn sub_assign(&mut self, other: CharacterSet)
Disables all flags enabled in the set.
impl Not for CharacterSet
impl Not for CharacterSet
type Output = CharacterSet
The resulting type after applying the !
operator.
fn not(self) -> CharacterSet
fn not(self) -> CharacterSet
Returns the complement of this set of flags.
impl Extend<CharacterSet> for CharacterSet
impl Extend<CharacterSet> for CharacterSet
fn extend<T: IntoIterator<Item = CharacterSet>>(&mut self, iterator: T)
fn extend<T: IntoIterator<Item = CharacterSet>>(&mut self, iterator: T)
Extends a collection with the contents of an iterator. Read more
impl FromIterator<CharacterSet> for CharacterSet
impl FromIterator<CharacterSet> for CharacterSet
fn from_iter<T: IntoIterator<Item = CharacterSet>>(iterator: T) -> CharacterSet
fn from_iter<T: IntoIterator<Item = CharacterSet>>(iterator: T) -> CharacterSet
Creates a value from an iterator. Read more
Auto Trait Implementations
impl Send for CharacterSet
impl Send for CharacterSet
impl Sync for CharacterSet
impl Sync for CharacterSet