pub struct EventBus { /* private fields */ }Expand description
A broadcast channel for crawler control-plane events.
Implementations§
Source§impl EventBus
impl EventBus
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Creates an event bus with the specified retained-message capacity.
§Panics
Panics when capacity is zero.
Sourcepub fn subscribe(&self) -> EventStream
pub fn subscribe(&self) -> EventStream
Creates a subscriber that receives events emitted after subscription.
Sourcepub fn emit(&self, event: CrawlerEvent)
pub fn emit(&self, event: CrawlerEvent)
Broadcasts an event to current subscribers.
The send error produced when no subscribers exist is intentionally ignored.
Sourcepub fn subscriber_count(&self) -> usize
pub fn subscriber_count(&self) -> usize
Returns the number of active subscribers.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for EventBus
impl !UnwindSafe for EventBus
impl Freeze for EventBus
impl Send for EventBus
impl Sync for EventBus
impl Unpin for EventBus
impl UnsafeUnpin for EventBus
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