pub struct Notifications { /* private fields */ }Expand description
A registry of event subscribers.
Implementations§
Source§impl Notifications
impl Notifications
pub fn new() -> Self
Sourcepub fn subscribe(
&mut self,
prefix: &str,
handler: impl Fn(&str, &str) + Send + Sync + 'static,
)
pub fn subscribe( &mut self, prefix: &str, handler: impl Fn(&str, &str) + Send + Sync + 'static, )
Subscribe to events whose name starts with prefix (e.g. "sql.").
Sourcepub fn instrument(&self, name: &str, payload: &str)
pub fn instrument(&self, name: &str, payload: &str)
Fire name with payload, invoking every subscriber whose prefix matches.
Trait Implementations§
Source§impl Default for Notifications
impl Default for Notifications
Source§fn default() -> Notifications
fn default() -> Notifications
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for Notifications
impl !UnwindSafe for Notifications
impl Freeze for Notifications
impl Send for Notifications
impl Sync for Notifications
impl Unpin for Notifications
impl UnsafeUnpin for Notifications
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