Struct TotalQty

Source
pub(super) struct TotalQty {
    raw: ByteQty,
}
Expand description

Total used, TotalQtyNotifier.total_used, found in State.total_used.

Can be “poisoned”, preventing further claims. (We mark it poisoned if the reclamation task crashes, since in that situation we don’t want to continue to use memory, unboundedly.)

Fields§

§raw: ByteQty

Implementations§

Source§

impl TotalQty

Source

pub(super) fn claim( &mut self, p_used: &mut ParticipQty, want: Qty, ) -> Option<ClaimedQty>

Claim a quantity, increasing the tracked amounts

This module doesn’t know anything about the memory quota, so this doesn’t do the quota check.

The only caller is Participation::claim.

Source

pub(super) fn release(&mut self, p_used: &mut ParticipQty, have: ClaimedQty)

Release a quantity, decreasing the tracked amounts

(Handles underflow by saturating; returning an error is not going to be useful.)

Source

pub(super) fn set_poisoned(&mut self)

Declare this poisoned, and prevent further claims

Trait Implementations§

Source§

impl BookkeepableQty for TotalQty

Source§

const ZERO: TotalQty

Zero (default value)
Source§

fn as_raw(&self) -> Qty

Inspect as a raw untracked Qty
Source§

impl BookkeptQty for TotalQty

Source§

fn from_raw(q: Qty) -> Self

Make a new bookkept quantity from a raw untracked Qty
Source§

fn into_raw(self) -> Qty

Unwrap into a raw untracked Qty
Source§

impl Debug for TotalQty

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TotalQty

Source§

fn default() -> TotalQty

Returns the “default value” for a type. Read more
Source§

impl DefaultExtTake for TotalQty

Source§

fn take(&mut self) -> Self

Returns *self, replacing it with the default value.
Source§

impl Display for TotalQty

Source§

fn fmt(&self, __derive_more_f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Rhs: BookkeepableQty> PartialEq<Rhs> for TotalQty

Source§

fn eq(&self, other: &Rhs) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<Rhs: BookkeepableQty> PartialOrd<Rhs> for TotalQty

Source§

fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
§

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,