pub struct EntityId(/* private fields */);Expand description
Identifies an entity: a person, a photo, a book, a list or anything else.
New identifiers are version 4 UUIDs. The text form is the lowercase hyphenated form of the UUID; in CBOR, an identifier is a UUID tag.
Implementations§
Source§impl EntityId
impl EntityId
Sourcepub fn from_random_bytes(bytes: [u8; 16]) -> Self
pub fn from_random_bytes(bytes: [u8; 16]) -> Self
Makes a new identifier from 16 random bytes. Six of the bits are replaced by the version and variant of a version 4 UUID.
Sourcepub fn derived(context: &str, material: &[u8]) -> Self
pub fn derived(context: &str, material: &[u8]) -> Self
The identifier derived from material with context: the first 16 bytes of
the BLAKE3 key derived with that context from it, as a version 4 UUID. Every
replica that derives one from the same material gets the same identifier.
Sourcepub fn random(rng: &mut impl CryptoRng) -> Self
pub fn random(rng: &mut impl CryptoRng) -> Self
Makes a new identifier from 16 bytes of the random number generator.
Sourcepub fn from_bytes(bytes: [u8; 16]) -> Self
pub fn from_bytes(bytes: [u8; 16]) -> Self
Returns the identifier with these 16 bytes, as stored. Any UUID is accepted, because an identifier is opaque.
Trait Implementations§
impl Copy for EntityId
impl Eq for EntityId
Source§impl Ord for EntityId
impl Ord for EntityId
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 EntityId
impl PartialOrd for EntityId
impl StructuralPartialEq for EntityId
Auto Trait Implementations§
impl Forget for EntityId
impl Freeze for EntityId
impl Move for EntityId
impl RefUnwindSafe for EntityId
impl Send for EntityId
impl Sync for EntityId
impl Unpin for EntityId
impl UnsafeUnpin for EntityId
impl UnwindSafe for EntityId
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