[][src]Struct tokio::sync::watch::Receiver

pub struct Receiver<T> { /* fields omitted */ }

Receives values from the associated Sender.

Instances are created by the channel function.

Methods

impl<T> Receiver<T>[src]

pub fn get_ref(&self) -> Ref<T>[src]

Returns a reference to the most recently sent value

Outstanding borrows hold a read lock. This means that long lived borrows could cause the send half to block. It is recommended to keep the borrow as short lived as possible.

Examples

let (_, rx) = watch::channel("hello");
assert_eq!(*rx.get_ref(), "hello");

pub fn poll_ref(&mut self) -> Result<Async<Option<Ref<T>>>, RecvError>[src]

Attempts to receive the latest value sent via the channel.

If a new, unobserved, value has been sent, a reference to it is returned. If no new value has been sent, then NotReady is returned and the current task is notified once a new value is sent.

Only the most recent value is returned. If the receiver is falling behind the sender, intermediate values are dropped.

Trait Implementations

impl<T> Clone for Receiver<T>[src]

impl<T> Debug for Receiver<T> where
    T: Debug
[src]

impl<T> Drop for Receiver<T>[src]

impl<T> Stream for Receiver<T> where
    T: Clone
[src]

type Item = T

The type of item this stream will yield on success.

type Error = RecvError

The type of error this stream may generate.

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.