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 const NAME: &'static str = "rerun.datatypes.TUID"
pub const NAME: &'static str = "rerun.datatypes.TUID"
We give an actual name to Tuid
, and inject that name into the Arrow datatype extensions,
as a hack so that we can compactly format them when printing Arrow data to the terminal.
Check out re_format_arrow
for context.
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 moreimpl Copy for Tuid
impl Eq for Tuid
impl StructuralPartialEq for Tuid
Auto Trait Implementations§
impl Freeze for Tuid
impl RefUnwindSafe for Tuid
impl Send for Tuid
impl Sync for Tuid
impl Unpin for Tuid
impl UnwindSafe for Tuid
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request