pub struct Millis(pub u32);Expand description
A span of time in milliseconds, for timeouts.
The value is a u32, so the longest representable span is about 49 days.
Arithmetic saturates instead of overflowing.
Tuple Fields§
§0: u32Implementations§
Trait Implementations§
impl Copy for Millis
impl Eq for Millis
Source§impl From<Duration> for Millis
Converts a duration, rounding any sub-millisecond part up.
impl From<Duration> for Millis
Converts a duration, rounding any sub-millisecond part up.
Only Duration::ZERO becomes zero, so a positive duration never turns
into a disabled timeout and a timer never fires early. Durations that do
not fit saturate at u32::MAX milliseconds and log an error.
Source§impl From<i32> for Millis
Converts a non-negative integer; negative values are invalid.
impl From<i32> for Millis
Converts a non-negative integer; negative values are invalid.
A negative value logs an error and becomes zero, which disables a timeout. Debug builds panic instead, so the mistake is caught early.
Source§impl Ord for Millis
impl Ord for Millis
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Millis
impl PartialOrd for Millis
impl StructuralPartialEq for Millis
Auto Trait Implementations§
impl Freeze for Millis
impl RefUnwindSafe for Millis
impl Send for Millis
impl Sync for Millis
impl Unpin for Millis
impl UnsafeUnpin for Millis
impl UnwindSafe for Millis
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.