pub struct DeadlineMicros(pub Option<u64>);Expand description
Bound on a deadline duration (microseconds for precision).
Uses microseconds internally to avoid floating point while supporting sub-millisecond precision. This is a min-plus semiring element where:
None= +∞ (unbounded)Some(n)= finite bound of n microseconds
Tuple Fields§
§0: Option<u64>Implementations§
Source§impl DeadlineMicros
impl DeadlineMicros
Sourcepub const fn from_micros(micros: u64) -> Self
pub const fn from_micros(micros: u64) -> Self
Creates a deadline from microseconds.
Sourcepub fn from_duration(d: Duration) -> Self
pub fn from_duration(d: Duration) -> Self
Creates a deadline from a Duration.
Sourcepub const fn is_unbounded(self) -> bool
pub const fn is_unbounded(self) -> bool
Returns true if this deadline is unbounded.
Sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Min-plus addition: min(a, b) in the deadline semiring.
The tighter (smaller) deadline wins.
Sourcepub fn add(self, other: Self) -> Self
pub fn add(self, other: Self) -> Self
Min-plus “multiplication”: a + b (sequential composition).
Sequential work adds deadlines.
Sourcepub fn is_at_least_as_tight_as(self, other: Self) -> bool
pub fn is_at_least_as_tight_as(self, other: Self) -> bool
Returns true if self is at least as tight as other.
Used for rewrite safety: a rewrite is safe if the new deadline is at least as tight as the original.
Trait Implementations§
Source§impl Clone for DeadlineMicros
impl Clone for DeadlineMicros
Source§fn clone(&self) -> DeadlineMicros
fn clone(&self) -> DeadlineMicros
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DeadlineMicros
impl Debug for DeadlineMicros
Source§impl Display for DeadlineMicros
impl Display for DeadlineMicros
Source§impl Ord for DeadlineMicros
impl Ord for DeadlineMicros
Source§fn cmp(&self, other: &DeadlineMicros) -> Ordering
fn cmp(&self, other: &DeadlineMicros) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for DeadlineMicros
impl PartialEq for DeadlineMicros
Source§impl PartialOrd for DeadlineMicros
impl PartialOrd for DeadlineMicros
impl Copy for DeadlineMicros
impl Eq for DeadlineMicros
impl StructuralPartialEq for DeadlineMicros
Auto Trait Implementations§
impl Freeze for DeadlineMicros
impl RefUnwindSafe for DeadlineMicros
impl Send for DeadlineMicros
impl Sync for DeadlineMicros
impl Unpin for DeadlineMicros
impl UnsafeUnpin for DeadlineMicros
impl UnwindSafe for DeadlineMicros
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Instruments this future with a span (no-op when disabled).
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> Self
Instruments this future with the current span (no-op when disabled).