pub struct Uuid { /* private fields */ }Expand description
This class defines an immutable universally unique identifier (UUID). It
represents a 128-bit value. More specifically, the random UUIDs generated by
this class are variant 2 (Leach-Salz) version 4 UUIDs. This is the same type
of UUID as the ones generated by java.util.UUID. The Display
implementation prints using the base64 string encoding. Likewise, the
from_string method expects a base64 string encoding.
Implementations§
Source§impl Uuid
impl Uuid
Sourcepub const ZERO_UUID: Uuid
pub const ZERO_UUID: Uuid
A UUID that represents a null or empty UUID. Will never be returned by random_uuid.
Sourcepub const METADATA_TOPIC_ID: Uuid = Self::ONE_UUID
pub const METADATA_TOPIC_ID: Uuid = Self::ONE_UUID
A UUID for the metadata topic in KRaft mode. Will never be returned by random_uuid.
Sourcepub const fn new(most_sig_bits: u64, least_sig_bits: u64) -> Self
pub const fn new(most_sig_bits: u64, least_sig_bits: u64) -> Self
Constructs a 128-bit type 4 UUID where the first long represents the most significant 64 bits and the second long represents the least significant 64 bits.
§Arguments
most_sig_bits- the most significant 64 bitsleast_sig_bits- the least significant 64 bits
Sourcepub fn random_uuid() -> Self
pub fn random_uuid() -> Self
Static factory to retrieve a type 4 (pseudo randomly generated) UUID.
This will not generate a UUID equal to ZERO_UUID, ONE_UUID, or one whose
string representation contains a dash (“-”).
Sourcepub const fn most_significant_bits(&self) -> u64
pub const fn most_significant_bits(&self) -> u64
Returns the most significant 64 bits of this UUID.
Sourcepub const fn least_significant_bits(&self) -> u64
pub const fn least_significant_bits(&self) -> u64
Returns the least significant 64 bits of this UUID.
Sourcepub fn from_string(s: &str) -> Result<Self, Error>
pub fn from_string(s: &str) -> Result<Self, Error>
Creates a UUID based on a base64 string encoding used in the to_string() method.
§Arguments
s- the base64 URL encoding, without padding
§Errors
Error::is_local_illegal_argument_errorifsis not the base64 encoding of 16 bytes
Trait Implementations§
Source§impl Ord for Uuid
impl Ord for Uuid
Source§impl PartialOrd for Uuid
impl PartialOrd for Uuid
impl Copy for Uuid
impl Eq for Uuid
impl StructuralPartialEq for Uuid
Auto Trait Implementations§
impl Freeze for Uuid
impl RefUnwindSafe for Uuid
impl Send for Uuid
impl Sync for Uuid
impl Unpin for Uuid
impl UnsafeUnpin for Uuid
impl UnwindSafe for Uuid
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.