pub struct RecordId(/* private fields */);Expand description
Identifies a named record ({type, ns, name}) for its lifetime.
Implementations§
Source§impl RecordId
impl RecordId
Sourcepub fn new() -> Self
pub fn new() -> Self
Mint a fresh identifier from the current time and 80 random bits. Two calls in the same millisecond are distinct but not ordered relative to each other; across milliseconds the later one sorts higher.
Sourcepub fn from_uuid(uuid: Uuid) -> Self
pub fn from_uuid(uuid: Uuid) -> Self
Rebuild from a uuid column. Every 128-bit value is a valid
ULID, so this cannot fail.
Sourcepub fn timestamp_ms(&self) -> u64
pub fn timestamp_ms(&self) -> u64
Milliseconds since the Unix epoch encoded in the identifier.
Sourcepub fn from_parts(timestamp_ms: u64, random: u128) -> Self
pub fn from_parts(timestamp_ms: u64, random: u128) -> Self
Build from explicit parts. For tests and fixtures; production
code mints with Self::new.
Trait Implementations§
impl Copy for RecordId
Source§impl<'de> Deserialize<'de> for RecordId
impl<'de> Deserialize<'de> for RecordId
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for RecordId
Source§impl Ord for RecordId
impl Ord for RecordId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for RecordId
impl PartialOrd for RecordId
impl StructuralPartialEq for RecordId
Auto Trait Implementations§
impl Freeze for RecordId
impl RefUnwindSafe for RecordId
impl Send for RecordId
impl Sync for RecordId
impl Unpin for RecordId
impl UnsafeUnpin for RecordId
impl UnwindSafe for RecordId
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
Compare self to
key and return true if they are equal.