pub struct Timestamp { /* private fields */ }
Expand description

A timestamp that can be encoded into a UUID.

This type abstracts the specific encoding, so versions 1, 6, and 7 UUIDs can both be supported through the same type, even though they have a different representation of a timestamp.

References

Implementations

Get a timestamp representing the current system time.

This method defers to the standard library’s SystemTime type.

Panics

This method will panic if calculating the elapsed time since the Unix epoch fails.

Construct a Timestamp from an RFC4122 timestamp and counter, as used in versions 1 and 6 UUIDs.

Construct a Timestamp from a Unix timestamp, as used in version 7 UUIDs.

Get the value of the timestamp as a Unix timestamp, as used in version 7 UUIDs.

👎Deprecated: use to_unix instead

Get the number of fractional nanoseconds in the Unix timestamp.

This method is deprecated and probably doesn’t do what you’re expecting it to. It doesn’t return the timestamp as nanoseconds since the Unix epoch, it returns the fractional seconds of the timestamp.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.