pub struct Disposer { /* private fields */ }Expand description
Reversible side effect (Cordis disposer). Callbacks run in reverse
insertion order, exactly once — on explicit Disposer::dispose or on
drop. Registration and disposal are paired.
Implementations§
Source§impl Disposer
impl Disposer
pub const fn new() -> Self
Sourcepub fn from_fn<F: FnOnce() + Send + Sync + 'static>(callback: F) -> Self
pub fn from_fn<F: FnOnce() + Send + Sync + 'static>(callback: F) -> Self
A disposer from a single teardown callback.
Sourcepub fn extend(self, later: Disposer) -> Self
pub fn extend(self, later: Disposer) -> Self
Appends later’s callbacks after self’s; disposal unwinds in
reverse insertion order, so later’s teardown runs first — matching
reverse activation order when later-registered disposers are merged in.
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Disposer
impl !UnwindSafe for Disposer
impl Forget for Disposer
impl Freeze for Disposer
impl Move for Disposer
impl Send for Disposer
impl Sync for Disposer
impl Unpin for Disposer
impl UnsafeUnpin for Disposer
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