pub struct Budget { /* private fields */ }Expand description
The deadline of one attempt (or one exchange), by Tokio’s monotonic clock, fixed at dispatch.
Implementations§
Source§impl Budget
impl Budget
Sourcepub fn start(remaining: DurationMs) -> Self
pub fn start(remaining: DurationMs) -> Self
The budget of an attempt dispatched now with remaining left.
pub fn from_ms(ms: u64) -> Self
pub fn deadline(&self) -> Instant
pub fn remaining(&self) -> Duration
Sourcepub fn remaining_ms(&self) -> u64
pub fn remaining_ms(&self) -> u64
Whole milliseconds left, rounded down.
pub fn expired(&self) -> bool
Sourcepub fn told_ms(&self, transit_margin_ms: u64) -> u64
pub fn told_ms(&self, transit_margin_ms: u64) -> u64
What the remote side is told: the time left minus the transit margin. Zero means there is no time to give it, and nothing should be sent.
Sourcepub fn phase_deadline(&self, limit: Option<Duration>) -> Instant
pub fn phase_deadline(&self, limit: Option<Duration>) -> Instant
The deadline of a phase: the budget’s, or limit from now when that
is earlier. A phase limit never extends the budget.
Trait Implementations§
impl Copy for Budget
impl Eq for Budget
impl StructuralPartialEq for Budget
Auto Trait Implementations§
impl Freeze for Budget
impl RefUnwindSafe for Budget
impl Send for Budget
impl Sync for Budget
impl Unpin for Budget
impl UnsafeUnpin for Budget
impl UnwindSafe for Budget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more