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
impl PwHashLimits
impl PwHashLimits
pub fn current() -> PwHashLimits
pub fn current() -> PwHashLimits
Get the current set limits
or the default “Moderate” limits if none are set by with_exec()
.
pub fn with_exec<R, F>(self, f: F) -> R where
F: FnOnce() -> R,
pub fn with_exec<R, F>(self, f: F) -> R where
F: FnOnce() -> R,
Execute a closure with these pwhash limits set.
pub fn as_mem_limit(&self) -> u32
pub fn as_mem_limit(&self) -> u32
translate into mem limit
pub fn as_ops_limit(&self) -> u32
pub fn as_ops_limit(&self) -> u32
translate into cpu limit
Trait Implementations
impl Clone for PwHashLimits
impl Clone for PwHashLimits
fn clone(&self) -> PwHashLimits
fn clone(&self) -> PwHashLimits
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for PwHashLimits
impl Debug for PwHashLimits
impl PartialEq<PwHashLimits> for PwHashLimits
impl PartialEq<PwHashLimits> for PwHashLimits
impl Copy for PwHashLimits
impl Eq for PwHashLimits
impl StructuralEq for PwHashLimits
impl StructuralPartialEq for PwHashLimits
Auto Trait Implementations
impl RefUnwindSafe for PwHashLimits
impl Send for PwHashLimits
impl Sync for PwHashLimits
impl Unpin for PwHashLimits
impl UnwindSafe for PwHashLimits
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more