pub enum PwHashLimits {
Minimum,
Interactive,
Moderate,
Sensitive,
}Expand description
Enum to specify limits (difficulty) for argon2id pwhashing algorithm.
Ops in this library don’t take explicit limit parameters. Instead, they check the current context, if not set using the default “Moderate” limits.
To set the context for the scope of the “with_exec” callback:
let _my_result = PwHashLimits::Sensitive.with_exec(|| {
// execute my function that needs "Sensitive" limits
});Variants§
Minimum
minimum limits (UNIT TESTING ONLY)
Interactive
low cpu/mem limits
Moderate
middle cpu/mem limits (default)
Sensitive
high cpu/mem limits
Implementations§
Source§impl PwHashLimits
impl PwHashLimits
Sourcepub fn current() -> Self
pub fn current() -> Self
Get the current set limits
or the default “Moderate” limits if none are set by with_exec().
Sourcepub fn with_exec<R, F>(self, f: F) -> Rwhere
F: FnOnce() -> R,
pub fn with_exec<R, F>(self, f: F) -> Rwhere
F: FnOnce() -> R,
Execute a closure with these pwhash limits set.
Sourcepub fn as_mem_limit(&self) -> u32
pub fn as_mem_limit(&self) -> u32
translate into mem limit
Sourcepub fn as_ops_limit(&self) -> u32
pub fn as_ops_limit(&self) -> u32
translate into cpu limit
Trait Implementations§
Source§impl Clone for PwHashLimits
impl Clone for PwHashLimits
Source§fn clone(&self) -> PwHashLimits
fn clone(&self) -> PwHashLimits
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PwHashLimits
impl Debug for PwHashLimits
Source§impl PartialEq for PwHashLimits
impl PartialEq for PwHashLimits
impl Copy for PwHashLimits
impl Eq for PwHashLimits
impl StructuralPartialEq for PwHashLimits
Auto Trait Implementations§
impl Freeze for PwHashLimits
impl RefUnwindSafe for PwHashLimits
impl Send for PwHashLimits
impl Sync for PwHashLimits
impl Unpin for PwHashLimits
impl UnwindSafe for PwHashLimits
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.