pub struct InstantBridge {
pub secs: i64,
pub nanos: u32,
}Expand description
Lightweight nanosecond-resolution instant bridge (T71).
Fields§
§secs: i64Unix seconds
nanos: u32Nanoseconds within the second (0–999,999,999)
Implementations§
Source§impl InstantBridge
impl InstantBridge
Sourcepub fn to_unix_secs(&self) -> i64
pub fn to_unix_secs(&self) -> i64
Project to Unix seconds (drops sub-second precision).
Sourcepub fn to_unix_nanos(&self) -> i64
pub fn to_unix_nanos(&self) -> i64
Project to Unix nanoseconds.
Sourcepub fn from_coarse(unix_secs: u32) -> Self
pub fn from_coarse(unix_secs: u32) -> Self
Convert from a coarse u32 Unix timestamp.
Sourcepub fn duration_since(&self, earlier: &InstantBridge) -> DurationBridge
pub fn duration_since(&self, earlier: &InstantBridge) -> DurationBridge
The duration between two instants: self - earlier.
Sourcepub fn add_duration(&self, d: &DurationBridge) -> InstantBridge
pub fn add_duration(&self, d: &DurationBridge) -> InstantBridge
Add a duration to this instant.
Sourcepub fn sub_duration(&self, d: &DurationBridge) -> InstantBridge
pub fn sub_duration(&self, d: &DurationBridge) -> InstantBridge
Subtract a duration from this instant.
Sourcepub fn is_before(&self, other: &InstantBridge) -> bool
pub fn is_before(&self, other: &InstantBridge) -> bool
Whether this instant is before another.
Sourcepub fn is_after(&self, other: &InstantBridge) -> bool
pub fn is_after(&self, other: &InstantBridge) -> bool
Whether this instant is after another.
Sourcepub fn min(self, other: InstantBridge) -> InstantBridge
pub fn min(self, other: InstantBridge) -> InstantBridge
The earlier of two instants.
Sourcepub fn max(self, other: InstantBridge) -> InstantBridge
pub fn max(self, other: InstantBridge) -> InstantBridge
The later of two instants.
Trait Implementations§
Source§impl Clone for InstantBridge
impl Clone for InstantBridge
impl Copy for InstantBridge
Source§impl Debug for InstantBridge
impl Debug for InstantBridge
Source§impl Default for InstantBridge
impl Default for InstantBridge
Source§impl<'de> Deserialize<'de> for InstantBridge
impl<'de> Deserialize<'de> for InstantBridge
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for InstantBridge
Source§impl Hash for InstantBridge
impl Hash for InstantBridge
Source§impl Ord for InstantBridge
impl Ord for InstantBridge
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 PartialEq for InstantBridge
impl PartialEq for InstantBridge
Source§impl PartialOrd for InstantBridge
impl PartialOrd for InstantBridge
Source§impl Serialize for InstantBridge
impl Serialize for InstantBridge
impl StructuralPartialEq for InstantBridge
Auto Trait Implementations§
impl Freeze for InstantBridge
impl RefUnwindSafe for InstantBridge
impl Send for InstantBridge
impl Sync for InstantBridge
impl Unpin for InstantBridge
impl UnsafeUnpin for InstantBridge
impl UnwindSafe for InstantBridge
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