pub struct RawUptime(/* private fields */);Expand description
A point on the monotonic clock at the hardware’s own rate, in nanoseconds since an origin near boot.
No time service adjusts its rate, so it drifts from an Uptime by as much as one slews the
monotonic clock, and the two never mix. It is written as the span since its origin, and parses
back from it.
§Examples
use t2t_core::{RawUptime, Timedelta};
let (start, end) = (RawUptime::from_secs(42), RawUptime::from_millis(42_010));
assert_eq!(end - start, Timedelta::from_millis(10), "a span free of any slewing");Implementations§
Source§impl RawUptime
impl RawUptime
Sourcepub const fn checked_add(self, span: Timedelta) -> Option<Self>
pub const fn checked_add(self, span: Timedelta) -> Option<Self>
The point span later, or None past the range.
Sourcepub const fn checked_sub(self, span: Timedelta) -> Option<Self>
pub const fn checked_sub(self, span: Timedelta) -> Option<Self>
The point span earlier, or None past the range.
Sourcepub const fn checked_since(self, start: Self) -> Option<Timedelta>
pub const fn checked_since(self, start: Self) -> Option<Timedelta>
The span since start, or None past the span’s range.
Source§impl RawUptime
impl RawUptime
Sourcepub const fn from_nanos(nanos: i64) -> Self
pub const fn from_nanos(nanos: i64) -> Self
The point nanos nanoseconds after the raw monotonic clock’s origin.
Sourcepub const fn from_micros(micros: i64) -> Self
pub const fn from_micros(micros: i64) -> Self
The point micros microseconds after the raw monotonic clock’s origin, saturating.
Sourcepub const fn from_millis(millis: i64) -> Self
pub const fn from_millis(millis: i64) -> Self
The point millis milliseconds after the raw monotonic clock’s origin, saturating.
Sourcepub const fn from_secs(secs: i64) -> Self
pub const fn from_secs(secs: i64) -> Self
The point secs seconds after the raw monotonic clock’s origin, saturating.
Sourcepub const fn as_micros(self) -> i64
pub const fn as_micros(self) -> i64
Whole microseconds since the raw monotonic clock’s origin, rounded down.
Trait Implementations§
Source§impl AddAssign<Timedelta> for RawUptime
impl AddAssign<Timedelta> for RawUptime
Source§fn add_assign(&mut self, span: Timedelta)
fn add_assign(&mut self, span: Timedelta)
+= operation. Read moreimpl Copy for RawUptime
Source§impl<'de> Deserialize<'de> for RawUptime
impl<'de> Deserialize<'de> for RawUptime
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
impl Eq for RawUptime
Source§impl FromBytes for RawUptimewhere
i64: FromBytes,
impl FromBytes for RawUptimewhere
i64: FromBytes,
§fn ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>where
Self: KnownLayout + Immutable,
fn ref_from_bytes(
source: &[u8],
) -> Result<&Self, ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>where
Self: KnownLayout + Immutable,
§fn ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>where
Self: KnownLayout + Immutable,
fn ref_from_prefix(
source: &[u8],
) -> Result<(&Self, &[u8]), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>where
Self: KnownLayout + Immutable,
§fn ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>where
Self: Immutable + KnownLayout,
fn ref_from_suffix(
source: &[u8],
) -> Result<(&[u8], &Self), ConvertError<AlignmentError<&[u8], Self>, SizeError<&[u8], Self>, !>>where
Self: Immutable + KnownLayout,
&Self. Read more§fn mut_from_bytes(
source: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>where
Self: IntoBytes + KnownLayout,
fn mut_from_bytes(
source: &mut [u8],
) -> Result<&mut Self, ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>where
Self: IntoBytes + KnownLayout,
§fn mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>where
Self: IntoBytes + KnownLayout,
fn mut_from_prefix(
source: &mut [u8],
) -> Result<(&mut Self, &mut [u8]), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>where
Self: IntoBytes + KnownLayout,
§fn mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>where
Self: IntoBytes + KnownLayout,
fn mut_from_suffix(
source: &mut [u8],
) -> Result<(&mut [u8], &mut Self), ConvertError<AlignmentError<&mut [u8], Self>, SizeError<&mut [u8], Self>, !>>where
Self: IntoBytes + KnownLayout,
§fn read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), SizeError<&[u8], Self>>where
Self: Sized,
fn read_from_prefix(
source: &[u8],
) -> Result<(Self, &[u8]), SizeError<&[u8], Self>>where
Self: Sized,
Source§impl FromZeros for RawUptimewhere
i64: FromZeros,
impl FromZeros for RawUptimewhere
i64: FromZeros,
§fn new_zeroed() -> Selfwhere
Self: Sized,
fn new_zeroed() -> Selfwhere
Self: Sized,
Self from zeroed bytes. Read more§fn new_box_zeroed() -> Result<Box<Self>, AllocError>where
Self: Sized,
fn new_box_zeroed() -> Result<Box<Self>, AllocError>where
Self: Sized,
Box<Self> from zeroed bytes. Read more§fn new_vec_zeroed(len: usize) -> Result<Vec<Self>, AllocError>where
Self: Sized,
fn new_vec_zeroed(len: usize) -> Result<Vec<Self>, AllocError>where
Self: Sized,
Vec<Self> from zeroed bytes. Read moreimpl Immutable for RawUptimewhere
i64: Immutable,
Source§impl IntoBytes for RawUptimewhere
i64: IntoBytes,
impl IntoBytes for RawUptimewhere
i64: IntoBytes,
§fn as_mut_bytes(&mut self) -> &mut [u8] ⓘwhere
Self: FromBytes,
fn as_mut_bytes(&mut self) -> &mut [u8] ⓘwhere
Self: FromBytes,
§fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to(&self, dst: &mut [u8]) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
§fn write_to_prefix(
&self,
dst: &mut [u8],
) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
fn write_to_prefix(
&self,
dst: &mut [u8],
) -> Result<(), SizeError<&Self, &mut [u8]>>where
Self: Immutable,
Source§impl JsonSchema for RawUptime
impl JsonSchema for RawUptime
Source§fn json_schema(_generator: &mut SchemaGenerator) -> Schema
fn json_schema(_generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl KnownLayout for RawUptimewhere
Self: Sized,
impl KnownLayout for RawUptimewhere
Self: Sized,
Source§type PointerMetadata = ()
type PointerMetadata = ()
Self. Read more§fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
fn size_for_metadata(meta: Self::PointerMetadata) -> Option<usize>
Self with the given pointer
metadata. Read moreSource§impl Ord for RawUptime
impl Ord for RawUptime
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for RawUptime
impl PartialOrd for RawUptime
impl StructuralPartialEq for RawUptime
Source§impl SubAssign<Timedelta> for RawUptime
impl SubAssign<Timedelta> for RawUptime
Source§fn sub_assign(&mut self, span: Timedelta)
fn sub_assign(&mut self, span: Timedelta)
-= operation. Read more