mirror of
https://github.com/uuid-rs/uuid.git
synced 2025-10-02 15:24:57 +00:00
parent
f362fa8b88
commit
bb409b369f
19
src/lib.rs
19
src/lib.rs
@ -759,6 +759,25 @@ impl Uuid {
|
||||
&self.0
|
||||
}
|
||||
|
||||
/// Consumes self and returns the underlying byte value of the UUID.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # use uuid::Uuid;
|
||||
/// let bytes = [
|
||||
/// 0xa1, 0xa2, 0xa3, 0xa4,
|
||||
/// 0xb1, 0xb2,
|
||||
/// 0xc1, 0xc2,
|
||||
/// 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8,
|
||||
/// ];
|
||||
/// let uuid = Uuid::from_bytes(bytes.clone());
|
||||
/// assert_eq!(bytes, uuid.into_bytes());
|
||||
/// ```
|
||||
pub const fn into_bytes(self) -> Bytes {
|
||||
self.0
|
||||
}
|
||||
|
||||
/// Tests if the UUID is nil.
|
||||
pub const fn is_nil(&self) -> bool {
|
||||
self.as_u128() == 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user