pub struct Consumer { /* private fields */ }Expand description
Subscribe to arbitrary broadcast/tracks.
Its close signal means this broadcast object ended, not that the path went offline: announcements say whether a path is live, and a new publisher may announce the same path again.
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.
Fails with Error::Unroutable once the broadcast has ended.
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 ends, by Producer::close or every producer dropping.
Returns Error::Dropped, or the error passed to the deprecated abort.
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.