ocelot-base 0.1.2

Shared base utilities for the ocelot project
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/// Represents a monotonic timestamp in nanoseconds.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
pub struct Timestamp(u128);

impl Timestamp {
    /// Creates a new timestamp from a nanosecond value.
    pub const fn new(nanos: u128) -> Self {
        Self(nanos)
    }

    /// Returns the stored nanosecond value.
    pub const fn as_nanos(self) -> u128 {
        self.0
    }
}