pub struct Participation(/* private fields */);
Expand description
Handle onto a participant’s participation in a tracker
Participation
is a handle. All clones are for use by the same conceptual Participant.
It doesn’t keep the underlying Account alive.
Participation
s are created by registering new participants,
for example using Account::register_participant
.
Variables of this type are often named partn
.
Implementations§
Source§impl Participation
impl Participation
Sourcepub fn claim(&mut self, want: usize) -> Result<()>
pub fn claim(&mut self, want: usize) -> Result<()>
Record that some memory has been (or will be) allocated
Sourcepub fn release(&mut self, have: usize)
pub fn release(&mut self, have: usize)
Record that some memory has been (or will be) freed by a participant
Sourcepub fn account(&self) -> WeakAccount
pub fn account(&self) -> WeakAccount
Obtain a handle onto the account
The returned handle is weak, and needs to be upgraded before use,
since a Participation
doesn’t keep its Account alive.
The returned WeakAccount
is equivalent to
all the other account handles for the same account.
Sourcepub fn destroy_participant(self)
pub fn destroy_participant(self)
Destroy this participant
Treat as freed all the memory allocated via this Participation
and its clones.
After this, other clones of this Participation
are no longer usable:
attempts to do so will give errors.
(although they can still be used to get at the Account
, if it still exists).
The actual memory should be freed promptly.
(It is not necessary to call this function in order to get the memory tracker
to free its handle onto the IsParticipant
,
because the memory quota system holds only a Weak
reference.)
Sourcepub fn new_dangling() -> Self
pub fn new_dangling() -> Self
Creates a new dangling, dummy, Participation
This can be used as a standin where a value of type Participation
is needed.
The returned value cannot be used to claim memory,
or find an Account
or MemoryQuotaTracker
.
Trait Implementations§
Source§impl Clone for Participation
impl Clone for Participation
Source§fn clone(&self) -> Participation
fn clone(&self) -> Participation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Participation
impl Debug for Participation
Source§impl Drop for Participation
impl Drop for Participation
Source§impl<T> From<Participation> for TypedParticipation<T>
impl<T> From<Participation> for TypedParticipation<T>
Source§fn from(untyped: Participation) -> TypedParticipation<T>
fn from(untyped: Participation) -> TypedParticipation<T>
Auto Trait Implementations§
impl Freeze for Participation
impl RefUnwindSafe for Participation
impl Send for Participation
impl Sync for Participation
impl Unpin for Participation
impl UnwindSafe for Participation
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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