diff --git a/src/lib.rs b/src/lib.rs index e350b520..c9bb731e 100644 --- a/src/lib.rs +++ b/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); + /// 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