pub struct EventHubClient { /* private fields */ }Expand description
EventHubClient - handles event passing from backend to UI Subscribe callbacks to specific event origins and start the event loop.
Implementations§
Source§impl EventHubClient
impl EventHubClient
Sourcepub fn subscribe<F>(&self, origin: Origin, callback: F) -> SubscriptionToken
pub fn subscribe<F>(&self, origin: Origin, callback: F) -> SubscriptionToken
Subscribe a callback to an origin. The returned SubscriptionToken
removes the callback from the subscribers map when dropped — hold it
for as long as you want the callback to fire, then drop it to
unsubscribe.
Sourcepub fn start(&self, shutdown_rx: Receiver<()>)
pub fn start(&self, shutdown_rx: Receiver<()>)
Start the event loop in a background thread.
The thread blocks on a flume::Selector that waits on either an
incoming event or the shutdown receiver. Zero CPU while idle —
no polling, no timeout. The thread exits when the matching
shutdown Sender is dropped (which makes shutdown_rx
Disconnected) or when the event hub’s sender drops.
Trait Implementations§
Source§impl Clone for EventHubClient
impl Clone for EventHubClient
Source§fn clone(&self) -> EventHubClient
fn clone(&self) -> EventHubClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for EventHubClient
impl !UnwindSafe for EventHubClient
impl Freeze for EventHubClient
impl Send for EventHubClient
impl Sync for EventHubClient
impl Unpin for EventHubClient
impl UnsafeUnpin for EventHubClient
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