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
See BookkeptQty
bomb: DropBombCondition
See BookkeptQty
Implementations§
Source§impl ClaimedQty
impl ClaimedQty
Sourcepub(super) fn split_off(&mut self, want: Qty) -> Option<ClaimedQty>
pub(super) fn split_off(&mut self, want: Qty) -> Option<ClaimedQty>
Split a ClaimedQty
into two ClaimedQty
s
Sourcepub(super) fn merge_into(&mut self, have: ClaimedQty)
pub(super) fn merge_into(&mut self, have: ClaimedQty)
Merge two ClaimedQty
s
(Handles overflow by saturating; returning an error is not going to be useful.)
Sourcepub(super) fn claim_return_to_participant(self) -> Result<()>
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
.
Sourcepub(super) fn release_got_from_participant(got: Qty) -> Self
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
.
Sourcepub(super) fn dispose_participant_destroyed(self)
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
impl BookkeepableQty for ClaimedQty
Source§impl BookkeptQty for ClaimedQty
impl BookkeptQty for ClaimedQty
Source§impl Debug for ClaimedQty
impl Debug for ClaimedQty
Source§impl Default for ClaimedQty
impl Default for ClaimedQty
Source§fn default() -> ClaimedQty
fn default() -> ClaimedQty
Source§impl DefaultExtTake for ClaimedQty
impl DefaultExtTake for ClaimedQty
Source§impl Display for ClaimedQty
impl Display for ClaimedQty
Source§impl<Rhs: BookkeepableQty> PartialEq<Rhs> for ClaimedQty
impl<Rhs: BookkeepableQty> PartialEq<Rhs> for ClaimedQty
Auto Trait Implementations§
impl Freeze for ClaimedQty
impl RefUnwindSafe for ClaimedQty
impl Send for ClaimedQty
impl Sync for ClaimedQty
impl Unpin for ClaimedQty
impl UnwindSafe for ClaimedQty
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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