pub struct Events { /* private fields */ }Expand description
A broadcaster of CacheEvents.
Cloning an Events shares the same underlying channel.
Implementations§
Source§impl Events
impl Events
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates a hub with the given subscriber buffer capacity.
Sourcepub fn subscribe(&self) -> Receiver<CacheEvent>
pub fn subscribe(&self) -> Receiver<CacheEvent>
Subscribes to the event stream.
A subscriber that falls behind by more than the buffer capacity will
observe a Lagged error from the receiver — events are best-effort
observability, never a correctness mechanism.
Sourcepub fn emit(&self, event: CacheEvent)
pub fn emit(&self, event: CacheEvent)
Emits an event. Does nothing if there are no subscribers.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Events
impl RefUnwindSafe for Events
impl Send for Events
impl Sync for Events
impl Unpin for Events
impl UnsafeUnpin for Events
impl UnwindSafe for Events
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