Struct sc_network::gossip::QueueGuard[][src]

#[must_use]pub struct QueueGuard<'a, M> { /* fields omitted */ }

Locked queue of messages to the given peer.

As long as this struct exists, the background task is asleep and the owner of the QueueGuard is in total control of the buffer. Messages can only ever be sent out after the QueueGuard is dropped.

Implementations

impl<'a, M: Send + 'static> QueueGuard<'a, M>[src]

pub fn push_or_discard(&mut self, message: M)[src]

Pushes a message to the queue, or discards it if the queue is full.

The message will only start being sent out after the QueueGuard is dropped.

pub fn retain(&mut self, filter: impl FnMut(&M) -> bool)[src]

Calls filter for each message in the queue, and removes the ones for which false is returned.

Note: The parameter of filter is a &M and not a &mut M (which would be better) because the underlying implementation relies on VecDeque::retain.

Trait Implementations

impl<'a, M> Drop for QueueGuard<'a, M>[src]

Auto Trait Implementations

impl<'a, M> !RefUnwindSafe for QueueGuard<'a, M>

impl<'a, M> Send for QueueGuard<'a, M> where
    M: Send

impl<'a, M> Sync for QueueGuard<'a, M> where
    M: Sync

impl<'a, M> Unpin for QueueGuard<'a, M>

impl<'a, M> !UnwindSafe for QueueGuard<'a, M>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CheckedConversion for T[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    T: From<Outer>,
    Outer: AsRef<T> + AsMut<T> + From<T>, 
[src]

pub fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

pub fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

impl<T> Pointable for T[src]

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> SaturatedConversion for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    T: Bounded,
    S: TryInto<T>, 
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]