pub struct Consumer { /* private fields */ }Expand description
Subscribe to arbitrary broadcast/tracks.
Implementations§
Source§impl Consumer
impl Consumer
Sourcepub fn track(&self, name: &str) -> Result<Consumer, Error>
pub fn track(&self, name: &str) -> Result<Consumer, Error>
Get a handle to a track on this broadcast.
Sourcepub fn demand(&self) -> Demand
pub fn demand(&self) -> Demand
A watch-only handle to the broadcast’s demand. See Demand.
The consumer-side sibling of Producer::demand, for a holder that has
only a read handle. Holding this handle, or the Consumer it came from,
is not itself demand.
Demand going away is Demand::unused resolving. The broadcast going
away is Error::Dropped, which here means the upstream producer ended.
Sourcepub async fn closed(&self) -> Error
pub async fn closed(&self) -> Error
Block until the broadcast is closed, by Producer::finish,
Producer::abort, or every producer dropping, and return the cause.
Returns the error passed to Producer::abort, or Error::Dropped for a
Producer::finish or a dropped producer (check Self::is_finished to
tell those apart).
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Whether the broadcast ended via a deliberate Producer::finish, as opposed
to aborting or losing its producer. false while the broadcast is still live.
Sourcepub fn poll_closed(&self, waiter: &Waiter) -> Poll<()>
pub fn poll_closed(&self, waiter: &Waiter) -> Poll<()>
Register a kio::Waiter that fires when the broadcast closes.
Returns Poll::Ready if already closed, otherwise Poll::Pending after
arming the waiter. Useful for composing close-detection into a larger poll
without spawning a task per broadcast.