pub struct DropFlag<'frame> { /* private fields */ }
Expand description
A drop flag, for tracking successful destruction.
A DropFlag
is a reference to a counter somewhere on the stack that lives
adjacent to storage for some value. It is just a counter: unsafe
code is
expected to associate semantic meaning to it.
A flag with a value of zero is usually called “dead”, and setting a flag to the dead state is called clearing it.
See the module documentation for more information.
Implementations§
Source§impl DropFlag<'_>
impl DropFlag<'_>
Sourcepub fn inc(self)
pub fn inc(self)
Increments the internal counter.
This function does not provide any overflow protection; unsafe
code is
responsible for making sure that cannot happen.
Sourcepub fn dec_and_check_if_died(self) -> bool
pub fn dec_and_check_if_died(self) -> bool
Decrements the internal counter and returns true if it became zero.
This function will return false
if the counter was already zero.
Trait Implementations§
Auto Trait Implementations§
impl<'frame> Freeze for DropFlag<'frame>
impl<'frame> !RefUnwindSafe for DropFlag<'frame>
impl<'frame> !Send for DropFlag<'frame>
impl<'frame> !Sync for DropFlag<'frame>
impl<'frame> Unpin for DropFlag<'frame>
impl<'frame> !UnwindSafe for DropFlag<'frame>
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