pub struct Tuid {
pub(crate) time_ns: u64,
pub(crate) inc: u64,
}
Fields§
§time_ns: u64
Approximate nanoseconds since epoch.
inc: u64
Initialized to something random on each thread,
then incremented for each new Tuid
being allocated.
Implementations§
source§impl Tuid
impl Tuid
sourcepub fn heap_size_bytes(&self) -> u64
pub fn heap_size_bytes(&self) -> u64
Returns the total size of self
on the heap, in bytes.
NOTE: This crate cannot depend on re_types_core
, therefore the actual implementation of
SizeBytes for Tuid
lives in re_types_core
and calls this method.
source§impl Tuid
impl Tuid
sourcepub fn from_nanos_and_inc(time_ns: u64, inc: u64) -> Self
pub fn from_nanos_and_inc(time_ns: u64, inc: u64) -> Self
Construct a Tuid
from the upper and lower halves of a u128-bit.
The first should be nano-seconds since epoch.
pub fn from_u128(id: u128) -> Self
pub fn as_u128(&self) -> u128
sourcepub fn nanoseconds_since_epoch(&self) -> u64
pub fn nanoseconds_since_epoch(&self) -> u64
Approximate nanoseconds since unix epoch.
The upper 64 bits of the Tuid
.
sourcepub fn incremented_by(&self, n: u64) -> Self
pub fn incremented_by(&self, n: u64) -> Self
Returns the n
-next logical Tuid
.
This is equivalent to calling Tuid::next
n
times.
Wraps the monotonically increasing back to zero on overflow.
Beware: wrong usage can easily lead to conflicts.
Prefer Tuid::new
when unsure.
sourcepub fn short_string(&self) -> String
pub fn short_string(&self) -> String
A shortened string representation of the Tuid
.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Tuid
impl<'de> Deserialize<'de> for Tuid
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>,
source§impl Ord for Tuid
impl Ord for Tuid
source§impl PartialEq for Tuid
impl PartialEq for Tuid
source§impl PartialOrd for Tuid
impl PartialOrd for Tuid
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more