pub struct Demand { /* private fields */ }Expand description
A cloneable, watch-only handle to a broadcast’s subscriber demand.
Obtained from Producer::demand; the broadcast-level sibling of
track::Demand. Demand means live interest in the
broadcast’s content: a subscribed spliced track on a route-fed broadcast, or
a pending track request / a consumed track on an ordinary one. A publisher
uses it to run expensive work only while someone is watching, and routing
uses it to advertise a warm copy at zero cost.
It’s a weak handle: it neither keeps the broadcast alive nor counts as
demand itself. Once every producer is gone, used /
unused return Error::Dropped.
Implementations§
Source§impl Demand
impl Demand
Sourcepub fn is_used(&self) -> bool
pub fn is_used(&self) -> bool
Whether the broadcast has live demand right now.
A point-in-time snapshot with no registration; use Self::used /
Self::unused (or their poll_* forms) to wait for the edge.
Sourcepub async fn used(&self) -> Result<(), Error>
pub async fn used(&self) -> Result<(), Error>
Block until the broadcast has demand. Resolves immediately if it already
does; returns Error::Dropped once every producer is gone.
Sourcepub async fn unused(&self) -> Result<(), Error>
pub async fn unused(&self) -> Result<(), Error>
Block until the broadcast has no demand. Resolves immediately if it has
none; returns Error::Dropped once every producer is gone.
Sourcepub fn poll_used(&self, waiter: &Waiter) -> Poll<Result<(), Error>>
pub fn poll_used(&self, waiter: &Waiter) -> Poll<Result<(), Error>>
Poll-based variant of Self::used.
Sourcepub fn poll_unused(&self, waiter: &Waiter) -> Poll<Result<(), Error>>
pub fn poll_unused(&self, waiter: &Waiter) -> Poll<Result<(), Error>>
Poll-based variant of Self::unused.