pub struct Delta { /* private fields */ }
Expand description
A span of time.
This struct represents a span of time, with its value stored as nanoseconds. The value can represent any valid i64 value, including negative, zero, and positive numbers.
Implementations§
Source§impl Delta
impl Delta
Sourcepub const fn from_micros(micros: i64) -> Self
pub const fn from_micros(micros: i64) -> Self
Create a new Delta
from a number of microseconds.
The micros
can range from -9_223_372_036_854_775 to 9_223_372_036_854_775.
If micros
is outside this range, i64::MIN
is used for negative values,
and i64::MAX
is used for positive values due to saturation.
Sourcepub const fn from_millis(millis: i64) -> Self
pub const fn from_millis(millis: i64) -> Self
Create a new Delta
from a number of milliseconds.
The millis
can range from -9_223_372_036_854 to 9_223_372_036_854.
If millis
is outside this range, i64::MIN
is used for negative values,
and i64::MAX
is used for positive values due to saturation.
Sourcepub const fn from_secs(secs: i64) -> Self
pub const fn from_secs(secs: i64) -> Self
Create a new Delta
from a number of seconds.
The secs
can range from -9_223_372_036 to 9_223_372_036.
If secs
is outside this range, i64::MIN
is used for negative values,
and i64::MAX
is used for positive values due to saturation.
Sourcepub fn is_negative(self) -> bool
pub fn is_negative(self) -> bool
Return true
if the Delta
spans a negative amount of time.
Sourcepub const fn as_micros_ceil(self) -> i64
pub const fn as_micros_ceil(self) -> i64
Return the smallest number of microseconds greater than or equal
to the value in the Delta
.