pub struct Consumer { /* private fields */ }Expand description
Subscribe to arbitrary broadcast/tracks.
Implementations§
Source§impl Consumer
impl Consumer
Sourcepub fn poll_route_changed(
&mut self,
waiter: &Waiter,
) -> Poll<Result<Route, Error>>
pub fn poll_route_changed( &mut self, waiter: &Waiter, ) -> Poll<Result<Route, Error>>
Poll for a route change. See Self::route_changed.
Sourcepub async fn route_changed(&mut self) -> Result<Route, Error>
pub async fn route_changed(&mut self) -> Result<Route, Error>
Wait for the broadcast’s Route to change.
The first call returns the current route immediately; each later call blocks
until it changes again, so a loop observes the initial value followed by
every update. Returns Error::Dropped once every producer is gone.
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 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;
an origin uses this to close a front immediately on a deliberate end instead
of lingering for a replacement.
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.