[][src]Struct barrage::Receiver

pub struct Receiver<T: Clone + Unpin>(_);

The receiver side of the channel. This will receive every message broadcast.

If receive is called twice on the same receiver, only one receive will receive the broadcast message. If both must receive it, clone the receiver.

Implementations

impl<T: Clone + Unpin> Receiver<T>[src]

pub fn recv(&self) -> Result<T, Disconnected>[src]

Receive a broadcast message. If there are none in the queue, it will block until another is sent or all senders disconnect.

pub fn try_recv(&self) -> Result<Option<T>, Disconnected>[src]

Try to receive a broadcast message. If there are none in the queue, it will return None, or if there are no senders it will return Disconnected.

pub fn recv_async(&self) -> RecvFut<'_, T>

Notable traits for RecvFut<'a, T>

impl<'a, T: Clone + Unpin> Future for RecvFut<'a, T> type Output = Result<T, Disconnected>;
[src]

Receive a broadcast message. If there are none in the queue, it will asynchronously wait until another is sent or all senders disconnect.

pub fn into_shared(self) -> SharedReceiver<T>[src]

Converts this receiver into a shared receiver.

Trait Implementations

impl<T: Clone + Unpin> Clone for Receiver<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Receiver<T>

impl<T> Send for Receiver<T> where
    T: Send + Sync

impl<T> Sync for Receiver<T> where
    T: Send + Sync

impl<T> Unpin for Receiver<T>

impl<T> !UnwindSafe for Receiver<T>

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> From<T> for T[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.