pub struct Dynamic { /* private fields */ }Expand description
Handles on-demand track creation for a broadcast.
When a consumer requests a track that doesn’t exist, the dynamic producer
picks up the request via Self::requested_track and either
track::Request::accepts it with a concrete track::Info or
track::Request::rejects it. Dropped when no longer needed; pending requests
are automatically aborted.
Implementations§
Source§impl Dynamic
impl Dynamic
Sourcepub fn poll_requested_track(
&mut self,
waiter: &Waiter,
) -> Poll<Result<Request, Error>>
pub fn poll_requested_track( &mut self, waiter: &Waiter, ) -> Poll<Result<Request, Error>>
Poll for the next consumer-requested track, without blocking.
Returns Error::Closed once the broadcast was deliberately ended
(Producer::finish or aborted), so a serving loop knows to stop and
release its handle.
Sourcepub async fn requested_track(&mut self) -> Result<Request, Error>
pub async fn requested_track(&mut self) -> Result<Request, Error>
Block until a consumer requests a track, returning a track::Request to serve.
Sourcepub fn consume(&self) -> Consumer
pub fn consume(&self) -> Consumer
Create a consumer that can subscribe to tracks in 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, returning the cause.
Sourcepub fn poll_closed(&self, waiter: &Waiter) -> Poll<Error>
pub fn poll_closed(&self, waiter: &Waiter) -> Poll<Error>
Poll until the broadcast closes; ready with the cause: the error passed to
Producer::abort, or Error::Dropped for a Producer::finish or a
dropped producer (check Consumer::is_finished to tell those apart).