pub struct Grant { /* private fields */ }Expand description
Follows a bandwidth grant through a Control on the ambient clock.
Wakes on every change to the grant and whenever the ramp allows the next step of a raise or the retry of a refused change, so a sender climbs back to its ceiling even after the grant goes quiet.
Follow a Reservation’s consumer: it reports whether a
session probes for it, which a rendition needs before it disables, and the slice it
would get back while unwatched, which it needs to resume after its viewers left.
Implementations§
Source§impl Grant
impl Grant
Sourcepub fn new(grant: Consumer, policy: Policy) -> Self
pub fn new(grant: Consumer, policy: Policy) -> Self
Follow grant under policy, starting at Policy::max.
Sourcepub fn assume(&mut self, target: Target)
pub fn assume(&mut self, target: Target)
Follow on from a sender already producing at target, such as one moving to a new
grant, rather than at Policy::max. The current grant is fed on the next poll, so a
sender below a grant that has room climbs back without waiting for the grant to change,
and one above Policy::max is lowered to it.
Sourcepub fn set_policy(&mut self, policy: Policy)
pub fn set_policy(&mut self, policy: Policy)
Follow under policy from now on, feeding it the current grant on the next poll.
A new ceiling or floor starts over at its Policy::max, as a fresh Grant
would, since the sender applied that ceiling itself. A new
lower alone keeps the target and ramp, since nothing retuned
the sender. Either way a disabled sender stays disabled until that grant resumes
it under the new policy, since nothing told it to start.
Sourcepub fn poll_next(&mut self, waiter: &Waiter) -> Poll<Result<Target, Error>>
pub fn poll_next(&mut self, waiter: &Waiter) -> Poll<Result<Target, Error>>
The next target the sender should produce at, or the error that closed the grant.
Sourcepub async fn next(&mut self) -> Result<Target, Error>
pub async fn next(&mut self) -> Result<Target, Error>
The next target the sender should produce at, or the error that closed the grant.
Awaits poll_next.
Sourcepub fn failed(&mut self)
pub fn failed(&mut self)
Take back the target poll_next last returned, because the sender
failed to apply it.
The previous target is restored and asked for again no sooner than one ramp step from now, so a quiet grant still retries and a sender that keeps failing is not hammered. Does nothing once another poll has fed the grant.