#[repr(C, align(1))]pub struct Tuid {
pub(crate) time_nanos: [u8; 8],
pub(crate) inc: [u8; 8],
}
Expand description
TUID: Time-based Unique Identifier.
Time-ordered globally unique 128-bit identifiers.
The raw bytes of the Tuid
sorts in time order as the Tuid
itself,
and the Tuid
is byte-aligned so you can just transmute between Tuid
and raw bytes.
Fields§
§time_nanos: [u8; 8]
§inc: [u8; 8]
Implementations§
Source§impl Tuid
impl Tuid
Sourcepub const ARROW_EXTENSION_NAME: &'static str = "rerun.datatypes.TUID"
pub const ARROW_EXTENSION_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.
Source§impl Tuid
impl Tuid
Sourcepub fn from_nanos_and_inc(time_nanos: u64, inc: u64) -> Tuid
pub fn from_nanos_and_inc(time_nanos: u64, inc: u64) -> Tuid
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) -> Tuid
pub fn as_u128(&self) -> u128
pub fn from_bytes(bytes: [u8; 16]) -> Tuid
Sourcepub fn nanos_since_epoch(&self) -> u64
pub fn nanos_since_epoch(&self) -> u64
Approximate nanoseconds since unix epoch.
The upper 64 bits of the Tuid
.
Sourcepub fn incremented_by(&self, n: u64) -> Tuid
pub fn incremented_by(&self, n: u64) -> Tuid
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<Tuid, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Tuid, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl Display for Tuid
Formats the Tuid
as a hex string.
impl Display for Tuid
Formats the Tuid
as a hex string.
The format uses upper case for the first 16 hex digits, and lower case for the last 16 hex digits. This is to make it easily distinguished from other hex strings.
Example: 182342300C5F8C327a7b4a6e5a379ac4
Source§impl Loggable for Tuid
impl Loggable for Tuid
Source§fn arrow_datatype() -> DataType
fn arrow_datatype() -> DataType
arrow::datatypes::DataType
, excluding datatype extensions.Source§fn to_arrow_opt<'a>(
_data: impl IntoIterator<Item = Option<impl Into<Cow<'a, Tuid>>>>,
) -> Result<Arc<dyn Array>, SerializationError>where
Tuid: 'a,
fn to_arrow_opt<'a>(
_data: impl IntoIterator<Item = Option<impl Into<Cow<'a, Tuid>>>>,
) -> Result<Arc<dyn Array>, SerializationError>where
Tuid: 'a,
Source§fn to_arrow<'a>(
iter: impl IntoIterator<Item = impl Into<Cow<'a, Tuid>>>,
) -> Result<Arc<dyn Array>, SerializationError>where
Tuid: 'a,
fn to_arrow<'a>(
iter: impl IntoIterator<Item = impl Into<Cow<'a, Tuid>>>,
) -> Result<Arc<dyn Array>, SerializationError>where
Tuid: 'a,
Source§fn from_arrow(array: &dyn Array) -> Result<Vec<Tuid>, DeserializationError>
fn from_arrow(array: &dyn Array) -> Result<Vec<Tuid>, DeserializationError>
Loggable
s.fn arrow_empty() -> Arc<dyn Array>
Source§fn from_arrow_opt(
data: &dyn Array,
) -> Result<Vec<Option<Self>>, DeserializationError>
fn from_arrow_opt( data: &dyn Array, ) -> Result<Vec<Option<Self>>, DeserializationError>
Loggable
s.Source§fn verify_arrow_array(data: &dyn Array) -> Result<(), DeserializationError>
fn verify_arrow_array(data: &dyn Array) -> Result<(), DeserializationError>
Source§impl Ord for Tuid
impl Ord for Tuid
Source§impl PartialOrd for Tuid
impl PartialOrd for Tuid
Source§impl Serialize for Tuid
impl Serialize for Tuid
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl SizeBytes for Tuid
impl SizeBytes for Tuid
Source§fn heap_size_bytes(&self) -> u64
fn heap_size_bytes(&self) -> u64
self
uses on the heap. Read moreSource§fn total_size_bytes(&self) -> u64
fn total_size_bytes(&self) -> u64
self
in bytes, accounting for both stack and heap space.Source§fn stack_size_bytes(&self) -> u64
fn stack_size_bytes(&self) -> u64
self
on the stack, in bytes. Read moreimpl AnyBitPattern for Tuid
impl Copy for Tuid
impl Eq for Tuid
impl NoUninit 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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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.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<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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§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