Struct ClaimedQty

Source
pub(super) struct ClaimedQty {
    raw: ByteQty,
    bomb: DropBombCondition,
}
Expand description

“Cached” claim, on behalf of a Participant

Found in Participation.cache, and accounted to the Participant (ie, included in ParticipQty).

Also used as a temporary variable in claim() and release() functions. When we return to the participant, outside the tracker, we essentially throw this away, since we don’t give the caller any representation to store. The participant is supposed to track this separately somehow.

Fields§

§raw: ByteQty§bomb: DropBombCondition

Implementations§

Source§

impl ClaimedQty

Source

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

Split a ClaimedQty into two ClaimedQtys

Source

pub(super) fn merge_into(&mut self, have: ClaimedQty)

Merge two ClaimedQtys

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

Source

pub(super) fn claim_return_to_participant(self) -> Result<()>

Obtain result for the participant, after having successfully recorded the amount claimed

§CORRECTNESS

This must be called only on a successful return path from Participation::claim.

Source

pub(super) fn release_got_from_participant(got: Qty) -> Self

When the participant indicates a release, enrol the amount in our bookkeeping scheme

Handles the quantity argument to Participation::release.

§CORRECTNESS

This must be called only on entry to Participation::release.

Source

pub(super) fn dispose_participant_destroyed(self)

Dispose of a quantity that was claimed by a now-destroyed participant

§CORRECTNESS

The ParticipQty this was claimed from must also have been destroyed.

So, ParticipQty::for_participant_teardown and the corresponding release must have been called earlier - possibly, much earlier.

Trait Implementations§

Source§

impl BookkeepableQty for ClaimedQty

Source§

const ZERO: ClaimedQty

Zero (default value)
Source§

fn as_raw(&self) -> Qty

Inspect as a raw untracked Qty
Source§

impl BookkeptQty for ClaimedQty

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 ClaimedQty

Source§

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

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

impl Default for ClaimedQty

Source§

fn default() -> ClaimedQty

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

impl DefaultExtTake for ClaimedQty

Source§

fn take(&mut self) -> Self

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

impl Display for ClaimedQty

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 ClaimedQty

Source§

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

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

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 ClaimedQty

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,