pub struct PersonId(/* private fields */);Expand description
Identifies a person who uses NibKeep.
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 PersonId
impl PersonId
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 PersonId
impl Eq for PersonId
Source§impl Ord for PersonId
impl Ord for PersonId
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 PersonId
impl PartialOrd for PersonId
impl StructuralPartialEq for PersonId
Auto Trait Implementations§
impl Forget for PersonId
impl Freeze for PersonId
impl Move for PersonId
impl RefUnwindSafe for PersonId
impl Send for PersonId
impl Sync for PersonId
impl Unpin for PersonId
impl UnsafeUnpin for PersonId
impl UnwindSafe for PersonId
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