[][src]Struct lolid::Timestamp

pub struct Timestamp { /* fields omitted */ }

Timestamp for use with v1 algorithm.

Implementations

impl Timestamp[src]

pub const fn from_parts(ticks: u64, counter: u16) -> Self[src]

Creates timestamp from raw parts, as per RFC4122.

  • ticks is number of 100-nanoseconds intervals elapsed since 15 Oct 1582 00:00:00.00.
  • counter is value used to differentiate between timestamps generated to avoid collision in case of rapid generation.

pub const fn from_unix(time: Duration) -> Self[src]

Creates instance from unix timestamp, namely it takes seconds and subsec_nanos.

Note it doesn't set counter, if needed it must be set manually

pub const fn set_counter(self, counter: u16) -> Self[src]

Sets counter to further avoid chance of collision between timestamps.

Useful if clock is not guaranteed to be monotonically increasing. Otherwise there is no benefit in setting the counter.

pub const fn into_parts(self) -> (u64, u16)[src]

Retrieves timestamp as raw parts

Trait Implementations

impl Clone for Timestamp[src]

impl Copy for Timestamp[src]

impl Debug for Timestamp[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.