pub struct Disposable;Expand description
Factory for common IDisposable implementations.
Implementations§
Source§impl Disposable
impl Disposable
Sourcepub fn empty() -> Rc<dyn IDisposable>
pub fn empty() -> Rc<dyn IDisposable>
A disposable that does nothing.
Sourcepub fn create(action: impl FnOnce() + 'static) -> Rc<dyn IDisposable>
pub fn create(action: impl FnOnce() + 'static) -> Rc<dyn IDisposable>
A disposable that runs action the first time it is disposed.
Sourcepub fn create_with_state<TState: 'static>(
state: TState,
dispose: impl FnOnce(TState) + 'static,
) -> Rc<dyn IDisposable>
pub fn create_with_state<TState: 'static>( state: TState, dispose: impl FnOnce(TState) + 'static, ) -> Rc<dyn IDisposable>
A disposable that gives state to dispose the first time it is
disposed.
Auto Trait Implementations§
impl Freeze for Disposable
impl RefUnwindSafe for Disposable
impl Send for Disposable
impl Sync for Disposable
impl Unpin for Disposable
impl UnsafeUnpin for Disposable
impl UnwindSafe for Disposable
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
The static constructor of a type: work done once per thread, after
the properties of the type are registered and before its first
instance exists (class handlers,
affects_render, metadata
overrides). Read more