Struct distant_net::server::QueuedServerReply
source · 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 async fn hold(&self, hold: bool)
pub async 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 async fn send(&self, data: T) -> Result<()>
pub async fn send(&self, data: T) -> Result<()>
Send this message, adding it to a queue if holding messages
sourcepub fn blocking_send(&self, data: T) -> Result<()>
pub fn blocking_send(&self, data: T) -> Result<()>
Send this message, adding it to a queue if holding messages, blocking for access to locks and other internals
sourcepub async fn send_before(&self, data: T) -> Result<()>
pub async fn send_before(&self, data: T) -> Result<()>
Send this message before anything else in the queue
sourcepub async fn flush(&self, hold: bool) -> Result<()>
pub async 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>
source§impl<T: Send + 'static> Reply for QueuedServerReply<T>
impl<T: Send + 'static> Reply for QueuedServerReply<T>
Auto Trait Implementations§
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