pub struct ObserverHandle { /* private fields */ }Expand description
RAII guard for an observer callback. Dropping the handle removes the callback from the signal, preventing memory leaks.
Implementations§
Source§impl ObserverHandle
impl ObserverHandle
Sourcepub fn new(
keeper: Rc<dyn Any>,
observer_id: u64,
remover: Rc<dyn Fn(u64)>,
) -> Self
pub fn new( keeper: Rc<dyn Any>, observer_id: u64, remover: Rc<dyn Fn(u64)>, ) -> Self
Create a new observer handle.
keeper: anRcthat keeps the observed source alive while this handle exists.observer_id: the ID identifying this observer.remover: called withobserver_idwhen the handle is dropped, to unregister the callback.
Trait Implementations§
Source§impl Debug for ObserverHandle
impl Debug for ObserverHandle
Source§impl Drop for ObserverHandle
impl Drop for ObserverHandle
Auto Trait Implementations§
impl !RefUnwindSafe for ObserverHandle
impl !Send for ObserverHandle
impl !Sync for ObserverHandle
impl !UnwindSafe for ObserverHandle
impl Freeze for ObserverHandle
impl Unpin for ObserverHandle
impl UnsafeUnpin for ObserverHandle
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