pub struct Quota { /* private fields */ }Expand description
An upper or lower bound for metrics.
Implementations§
Source§impl Quota
impl Quota
Sourcepub fn new(bound: f64, upper: bool) -> Self
pub fn new(bound: f64, upper: bool) -> Self
Creates a quota with the given bound and whether it is an upper bound.
§Arguments
bound- the bound valueupper-truefor an upper bound,falsefor a lower bound
Sourcepub fn upper_bound(upper_bound: f64) -> Self
pub fn upper_bound(upper_bound: f64) -> Self
Sourcepub fn lower_bound(lower_bound: f64) -> Self
pub fn lower_bound(lower_bound: f64) -> Self
Sourcepub fn is_upper_bound(&self) -> bool
pub fn is_upper_bound(&self) -> bool
Returns whether this quota is an upper bound.
Sourcepub fn acceptable(&self, value: f64) -> bool
pub fn acceptable(&self, value: f64) -> bool
Returns whether the given value is acceptable under this quota.
§Arguments
value- the value to check against the bound
Trait Implementations§
Source§impl Hash for Quota
Hashes what PartialEq compares. Java hashes (int) bound, which would
put 0.0 and -0.0, now unequal, under one hash; the Rust hash only has
to agree with Rust’s equality, so it takes the bits.
impl Hash for Quota
Hashes what PartialEq compares. Java hashes (int) bound, which would
put 0.0 and -0.0, now unequal, under one hash; the Rust hash only has
to agree with Rust’s equality, so it takes the bits.
Source§impl PartialEq for Quota
Java’s Quota.equals compares bound with the primitive ==, under which
NaN differs from itself and 0.0 equals -0.0. A lawful Eq must be
reflexive, so the bound is compared as Java’s Double.equals compares it
instead: every NaN is equal, and the two zeros differ. Any other bound
compares as in Java.
impl PartialEq for Quota
Java’s Quota.equals compares bound with the primitive ==, under which
NaN differs from itself and 0.0 equals -0.0. A lawful Eq must be
reflexive, so the bound is compared as Java’s Double.equals compares it
instead: every NaN is equal, and the two zeros differ. Any other bound
compares as in Java.
impl Eq for Quota
Auto Trait Implementations§
impl Freeze for Quota
impl RefUnwindSafe for Quota
impl Send for Quota
impl Sync for Quota
impl Unpin for Quota
impl UnsafeUnpin for Quota
impl UnwindSafe for Quota
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more