pub struct FlushGate<T> { /* private fields */ }Expand description
FlushGate is a state machine for gating message writes during an initial flush.
Implementations§
Source§impl<T> FlushGate<T>
impl<T> FlushGate<T>
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Number of pending items in the queue.
Sourcepub fn end(&mut self) -> Vec<T>
pub fn end(&mut self) -> Vec<T>
End the flush and return any queued items for draining. Caller is responsible for sending the returned items.
Sourcepub fn enqueue(&mut self, items: Vec<T>) -> bool
pub fn enqueue(&mut self, items: Vec<T>) -> bool
If flush is active, queue the items and return true. If flush is not active, return false (caller should send directly).
Sourcepub fn enqueue_one(&mut self, item: T) -> bool
pub fn enqueue_one(&mut self, item: T) -> bool
Enqueue a single item.
Sourcepub fn drop(&mut self) -> usize
pub fn drop(&mut self) -> usize
Discard all queued items (permanent transport close). Returns the number of items dropped.
Sourcepub fn deactivate(&mut self)
pub fn deactivate(&mut self)
Clear the active flag without dropping queued items. Used when the transport is replaced - the new transport’s flush will drain the pending items.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for FlushGate<T>
impl<T> RefUnwindSafe for FlushGate<T>where
T: RefUnwindSafe,
impl<T> Send for FlushGate<T>where
T: Send,
impl<T> Sync for FlushGate<T>where
T: Sync,
impl<T> Unpin for FlushGate<T>where
T: Unpin,
impl<T> UnsafeUnpin for FlushGate<T>
impl<T> UnwindSafe for FlushGate<T>where
T: UnwindSafe,
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