impl Default for Uuid
This commit is contained in:
1 parent
66f3bee9fc
commit
bd2b3a8a29
1 file changed
+13
+13
@@ -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;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user