pub struct VersionId(/* private fields */);Expand description
Identifies one immutable version of a record. Relations point at these; tombstones keep them.
Implementations§
Source§impl VersionId
impl VersionId
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 VersionId
Source§impl<'de> Deserialize<'de> for VersionId
impl<'de> Deserialize<'de> for VersionId
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 VersionId
Source§impl Ord for VersionId
impl Ord for VersionId
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 VersionId
impl PartialOrd for VersionId
impl StructuralPartialEq for VersionId
Auto Trait Implementations§
impl Freeze for VersionId
impl RefUnwindSafe for VersionId
impl Send for VersionId
impl Sync for VersionId
impl Unpin for VersionId
impl UnsafeUnpin for VersionId
impl UnwindSafe for VersionId
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.