pub struct CallbackHandle { /* private fields */ }Expand description
Owns a resource that must be cleaned up when the owning TaskScope
is dropped.
Currently used for signal subscriptions registered by the bind_*
functions. When the TaskScope drops, every registered
CallbackHandle is dropped, which calls the stored cleanup closure
to unsubscribe from the signal.
Implementations§
Source§impl CallbackHandle
impl CallbackHandle
Sourcepub fn noop() -> Self
pub fn noop() -> Self
Create a no-op handle that does nothing on drop.
Useful as a placeholder when a CallbackHandle is required
but no cleanup is needed — for example, in framework glue code
that always calls register_callback_handle
but whose inner binding may be a no-op.
Trait Implementations§
Source§impl Drop for CallbackHandle
impl Drop for CallbackHandle
Auto Trait Implementations§
impl Freeze for CallbackHandle
impl !RefUnwindSafe for CallbackHandle
impl !Send for CallbackHandle
impl !Sync for CallbackHandle
impl Unpin for CallbackHandle
impl UnsafeUnpin for CallbackHandle
impl !UnwindSafe for CallbackHandle
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