pub struct WatchReceiver { /* private fields */ }Expand description
The receive end of a watch channel: observes value changes.
Does not implement Clone — a single receive end can only be driven by one waiter at a time
(serialized by an internal lock). For multiple observers, call subscribe
on the WatchChannel separately for each.
Implementations§
Source§impl WatchReceiver
impl WatchReceiver
Sourcepub async fn recv(&self) -> Result<IncomingMessage, ChannelError>
pub async fn recv(&self) -> Result<IncomingMessage, ChannelError>
Waits for a change and takes the latest value.
§Errors
Returns ChannelError::Closed when the sender (WatchChannel) has been dropped.
§Cancellation semantics
Being cancelled while waiting has no side effects: watch is not a queue and has no “take one item” concept,
the next recv starts from the latest value and keeps waiting for the next change.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for WatchReceiver
impl !RefUnwindSafe for WatchReceiver
impl Send for WatchReceiver
impl Sync for WatchReceiver
impl Unpin for WatchReceiver
impl UnsafeUnpin for WatchReceiver
impl UnwindSafe for WatchReceiver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more