impl Default for Uuid

main
Pantonshire 4 years ago
parent 66f3bee9fc
commit bd2b3a8a29

@ -33,6 +33,12 @@ pub struct Uuid([u8; 16]);
// 15 | // 15 |
impl Uuid { impl Uuid {
#[inline]
#[must_use]
pub const fn nil() -> Self {
Self([0; 16])
}
#[inline] #[inline]
#[must_use] #[must_use]
pub const fn from_bytes(bytes: [u8; 16]) -> Self { pub const fn from_bytes(bytes: [u8; 16]) -> Self {
@ -62,6 +68,13 @@ impl Uuid {
} }
} }
impl Default for Uuid {
#[inline]
fn default() -> Self {
Self::nil()
}
}
impl str::FromStr for Uuid { impl str::FromStr for Uuid {
type Err = ParseError; type Err = ParseError;

Loading…
Cancel
Save