pub struct EventHub { /* private fields */ }Expand description
Central event hub for managing subscriptions and dispatching events
Implementations§
Source§impl EventHub
impl EventHub
Sourcepub fn start_event_loop(&self, stop_signal: Arc<AtomicBool>) -> JoinHandle<()>
pub fn start_event_loop(&self, stop_signal: Arc<AtomicBool>) -> JoinHandle<()>
Start the event processing loop.
Returns a JoinHandle so the caller can join the thread on shutdown.
The loop checks stop_signal between receives via a timeout, ensuring
it will exit even if no events arrive.
Sourcepub fn send_event(&self, event: Event)
pub fn send_event(&self, event: Event)
Send an event to the queue
pub fn get_queue(&self) -> Queue
Sourcepub fn subscribe_receiver(&self) -> Receiver<Event>
pub fn subscribe_receiver(&self) -> Receiver<Event>
Get a direct event receiver.
The receiver blocks on recv() until an event arrives — no polling needed.
Important: flume uses MPMC semantics — each event is delivered to exactly
one receiver. Multiple cloned receivers compete for events rather than each
receiving a copy. Ensure only one consumer calls subscribe_receiver().
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EventHub
impl RefUnwindSafe for EventHub
impl Send for EventHub
impl Sync for EventHub
impl Unpin for EventHub
impl UnsafeUnpin for EventHub
impl UnwindSafe for EventHub
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