From bd2b3a8a29b34ffeecd658b74ef81a1431fc91f0 Mon Sep 17 00:00:00 2001 From: Pantonshire Date: Wed, 25 May 2022 15:45:48 +0100 Subject: [PATCH] impl Default for Uuid --- src/uuid.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/uuid.rs b/src/uuid.rs index 374601e..5a2bcd9 100644 --- a/src/uuid.rs +++ b/src/uuid.rs @@ -33,6 +33,12 @@ pub struct Uuid([u8; 16]); // 15 | impl Uuid { + #[inline] + #[must_use] + pub const fn nil() -> Self { + Self([0; 16]) + } + #[inline] #[must_use] 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 { type Err = ParseError;