pub struct Tid(/* private fields */);Expand description
A validated TID (Timestamp Identifier).
TIDs are exactly 13 characters from the base32-sortable alphabet.
Implementations§
Source§impl Tid
impl Tid
Sourcepub fn new(s: &str) -> Result<Self, InvalidTidError>
pub fn new(s: &str) -> Result<Self, InvalidTidError>
Create a new Tid from a string, validating the format.
Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Consume and return the inner string.
Sourcepub fn timestamp_micros(&self) -> u64
pub fn timestamp_micros(&self) -> u64
Decode the TID to its underlying microsecond timestamp.
Sourcepub fn from_timestamp(timestamp_micros: u64, clock_id: u16) -> Self
pub fn from_timestamp(timestamp_micros: u64, clock_id: u16) -> Self
Encode a microsecond timestamp and clock ID into a TID.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tid
impl<'de> Deserialize<'de> for Tid
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Tid
impl Ord for Tid
Source§impl PartialOrd for Tid
impl PartialOrd for Tid
impl Eq for Tid
impl StructuralPartialEq for Tid
Auto Trait Implementations§
impl Freeze for Tid
impl RefUnwindSafe for Tid
impl Send for Tid
impl Sync for Tid
impl Unpin for Tid
impl UnsafeUnpin for Tid
impl UnwindSafe for Tid
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
Mutably borrows from an owned value. Read more