pub struct Revertible<F>{ /* private fields */ }Expand description
A revertible action.
Returned by several functions registering callbacks that may have to be unregistered later.
This type is marked as must_use to force being explicit about handling reversions.
There several ways to deal with a received Revertible:
- Call
revert_on_unloadto automatically revert on addon unload. - Call
leakor drop it (explicitly or implicitly) to discard and unregister manually. - Keep the
Revertibleand callrevertlater. - Turn it into a callable via
into_innerand call it later.
Implementations§
Source§impl<F> Revertible<F>
impl<F> Revertible<F>
Sourcepub fn into_inner(self) -> F
pub fn into_inner(self) -> F
Turns the revertible into the inner callable.
Sourcepub fn leak(self)
pub fn leak(self)
Leaves the action to not be reverted.
The reversion has to be performed manually. Effectively the same as dropping the revertible.
Sourcepub fn revert_on_unload(self)
pub fn revert_on_unload(self)
Submits the revertible to be reverted on unload.
Trait Implementations§
Source§impl<F> Debug for Revertible<F>
impl<F> Debug for Revertible<F>
Auto Trait Implementations§
impl<F> Freeze for Revertible<F>where
F: Freeze,
impl<F> RefUnwindSafe for Revertible<F>where
F: RefUnwindSafe,
impl<F> Send for Revertible<F>
impl<F> Sync for Revertible<F>where
F: Sync,
impl<F> Unpin for Revertible<F>where
F: Unpin,
impl<F> UnwindSafe for Revertible<F>where
F: UnwindSafe,
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