pub struct QueuedServerReply<T> { /* private fields */ }
Expand description
Represents a reply where all sends are queued up but not sent until after the flush method is called. This reply supports injecting at the front of the queue in order to support sending messages but ensuring that some specific message is sent out first
Implementations§
Source§impl<T> QueuedServerReply<T>
impl<T> QueuedServerReply<T>
Sourcepub fn hold(&self, hold: bool)
pub fn hold(&self, hold: bool)
Updates the hold status for the queue
- If true, all messages are held until the queue is flushed
- If false, messages are sent directly as they come in
Sourcepub fn send(&self, data: T) -> Result<()>
pub fn send(&self, data: T) -> Result<()>
Send this message, adding it to a queue if holding messages.
Sourcepub fn send_before(&self, data: T) -> Result<()>
pub fn send_before(&self, data: T) -> Result<()>
Send this message before anything else in the queue
Sourcepub fn flush(&self, hold: bool) -> Result<()>
pub fn flush(&self, hold: bool) -> Result<()>
Sends all pending msgs queued up and clears the queue
Additionally, takes hold
to indicate whether or not new msgs
after the flush should continue to be held within the queue
or if all future msgs will be sent immediately
pub fn is_closed(&self) -> bool
Trait Implementations§
Source§impl<T> Clone for QueuedServerReply<T>
impl<T> Clone for QueuedServerReply<T>
Auto Trait Implementations§
impl<T> Freeze for QueuedServerReply<T>
impl<T> RefUnwindSafe for QueuedServerReply<T>
impl<T> Send for QueuedServerReply<T>where
T: Send,
impl<T> Sync for QueuedServerReply<T>where
T: Send,
impl<T> Unpin for QueuedServerReply<T>
impl<T> UnwindSafe for QueuedServerReply<T>
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