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

pub struct Receiver<T> { /* fields omitted */ }
This is supported on feature="sync" and feature="sync" only.

Receives values from the associated Sender.

Instances are created by the channel function.

Methods

impl<T> Receiver<T>[src]

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

This is supported on feature="sync" and feature="sync" only.

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

use tokio::sync::watch;

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

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

pub async fn recv<'_>(&'_ mut self) -> Option<T>[src]

This is supported on feature="sync" and feature="sync" only.

Attempts to clone the latest value sent via the channel.

Trait Implementations

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

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

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

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

type Item = T

Values yielded by the stream.

Auto Trait Implementations

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>

impl<T> !RefUnwindSafe for Receiver<T>

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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

impl<S, T, E> TryStream for S where
    S: Stream<Item = Result<T, E>> + ?Sized
[src]

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future