pub struct SpaceId(/* private fields */);Expand description
Identifies a space, the unit of sharing, sync and encryption.
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 SpaceId
impl SpaceId
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 SpaceId
impl Eq for SpaceId
Source§impl Ord for SpaceId
impl Ord for SpaceId
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 SpaceId
impl PartialOrd for SpaceId
impl StructuralPartialEq for SpaceId
Auto Trait Implementations§
impl Forget for SpaceId
impl Freeze for SpaceId
impl Move for SpaceId
impl RefUnwindSafe for SpaceId
impl Send for SpaceId
impl Sync for SpaceId
impl Unpin for SpaceId
impl UnsafeUnpin for SpaceId
impl UnwindSafe for SpaceId
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