pub struct Hlc {
pub wall_ms: TimestampMs,
pub counter: u32,
pub device_id: String,
}Expand description
A single hybrid-logical-clock reading.
§Example
use grit_core::Hlc;
let a = Hlc::new(1000, 0, "dev-a");
let b = Hlc::new(1000, 1, "dev-a");
assert!(a < b);
assert_eq!(a, a.encode().parse().unwrap());Fields§
§wall_ms: TimestampMsWall-clock component, ms since epoch.
counter: u32Logical counter, bumps when wall time stalls or runs backwards.
device_id: StringTie-breaker: the originating device.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Hlc
impl<'de> Deserialize<'de> for Hlc
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 Hlc
Source§impl Ord for Hlc
impl Ord for Hlc
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
Source§impl PartialOrd for Hlc
impl PartialOrd for Hlc
impl StructuralPartialEq for Hlc
Auto Trait Implementations§
impl Freeze for Hlc
impl RefUnwindSafe for Hlc
impl Send for Hlc
impl Sync for Hlc
impl Unpin for Hlc
impl UnsafeUnpin for Hlc
impl UnwindSafe for Hlc
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