[−][src]Struct tokio_sync::watch::Receiver
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) -> Poll<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> Drop for Receiver<T>
[src][+]
impl<T: Debug> Debug for Receiver<T>
[src][+]
impl<T: Clone> Stream for Receiver<T>
[src][+]
Auto Trait Implementations
impl<T> Send for Receiver<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> Sync for Receiver<T> where
T: Send + Sync,
T: Send + Sync,
Blanket Implementations
impl<T> From for T
[src][−]
impl<T, U> Into for T where
U: From<T>,
[src][−]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][−]
T: Clone,
impl<T, U> TryFrom for T where
T: From<U>,
[src][−]
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src][−]
impl<T> Borrow for T where
T: ?Sized,
[src][−]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src][−]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src][−]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src][−]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src][−]
impl<T> Any for T where
T: 'static + ?Sized,
[src][−]
T: 'static + ?Sized,