pub struct Notifier { /* private fields */ }Expand description
Ordered, panic-isolated registry of CommitObservers.
Implementations§
Source§impl Notifier
impl Notifier
pub fn new() -> Self
Sourcepub fn add_observer(&self, obs: Arc<dyn CommitObserver>) -> ObserverHandle
pub fn add_observer(&self, obs: Arc<dyn CommitObserver>) -> ObserverHandle
Registers obs. The returned ObserverHandle owns the strong
Arc and unregisters on drop (RAII); the registry holds only a
Weak, so the handle’s lifetime alone controls delivery and no
Notifier → observer → … → Notifier strong cycle can form.
Sourcepub fn dispatch(&self, ev: &CommitEvent)
pub fn dispatch(&self, ev: &CommitEvent)
Dispatches ev to every live observer in registration order.
Each on_commit is catch_unwind-isolated: a panicking
observer poisons neither the caller (the committing thread) nor
any other observer.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Notifier
impl RefUnwindSafe for Notifier
impl Send for Notifier
impl Sync for Notifier
impl Unpin for Notifier
impl UnsafeUnpin for Notifier
impl UnwindSafe for Notifier
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