pub trait Consume<T>: Send + Sync {
// Required methods
fn recv(&self) -> Result<T, Disconnected>;
fn try_recv(&self) -> Option<T>;
}Expand description
A transport’s consuming half.
There is no is_disconnected here on purpose: a poll that finds an empty
queue cannot tell “nothing yet” from “nothing ever”, and answering wrongly
either way would let a caller discard live work. A consumer learns the
channel is closed from Consume::recv returning Disconnected.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".