pub struct ControlHandle<N>where
N: Notify,{ /* private fields */ }
Expand description
A control handle that can control the event queue.
Implementations§
Source§impl<N> ControlHandle<N>where
N: Notify,
impl<N> ControlHandle<N>where
N: Notify,
Sourcepub async fn add_client(&mut self, notifier: N) -> Result<(), EventQueueDropped>
pub async fn add_client(&mut self, notifier: N) -> Result<(), EventQueueDropped>
Add a new client to the event queue. If there were events queued before, the new client will receive the last event.
Sourcepub async fn clear(&mut self) -> Result<(), EventQueueDropped>
pub async fn clear(&mut self) -> Result<(), EventQueueDropped>
Make all existing clients in the event queue stop adding new events to their queue, and once they receive all queued events, they will be dropped.
Sourcepub async fn queue_event(
&mut self,
event: N::Event,
) -> Result<(), EventQueueDropped>
pub async fn queue_event( &mut self, event: N::Event, ) -> Result<(), EventQueueDropped>
Queue an event that will be sent to all clients.
Sourcepub async fn try_flush(
&mut self,
timeout: Duration,
) -> Result<impl Future<Output = Result<(), TimedOut>>, EventQueueDropped>
pub async fn try_flush( &mut self, timeout: Duration, ) -> Result<impl Future<Output = Result<(), TimedOut>>, EventQueueDropped>
Try to flush all pending events to all connected clients, returning a future that completes once all events are flushed or the given timeout duration is reached.
Sourcepub async fn ping(&mut self) -> Result<(), EventQueueDropped>
pub async fn ping(&mut self) -> Result<(), EventQueueDropped>
Pings the event queue. When this returns, you can be sure that all previous actions via this control handle have been processed (but not necessarily forwarded to all clients yet).
Trait Implementations§
Source§impl<N> Clone for ControlHandle<N>where
N: Notify,
impl<N> Clone for ControlHandle<N>where
N: Notify,
Auto Trait Implementations§
impl<N> Freeze for ControlHandle<N>
impl<N> !RefUnwindSafe for ControlHandle<N>
impl<N> Send for ControlHandle<N>
impl<N> Sync for ControlHandle<N>
impl<N> Unpin for ControlHandle<N>
impl<N> !UnwindSafe for ControlHandle<N>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)