pub trait UuidExt: Sized {
fn parse(src: impl AsRef<[u8]>) -> Result<Self, Error>;
fn parse_simple(src: impl AsRef<[u8]>) -> Result<Self, Error>;
fn parse_hyphenated(src: impl AsRef<[u8]>) -> Result<Self, Error>;
fn format_simple(&self) -> Simple<'_>;
fn format_hyphenated(&self) -> Hyphenated<'_>;
}
Available on crate feature
uuid
only.Expand description
An extension trait for uuid::Uuid
Required Methods§
sourcefn parse(src: impl AsRef<[u8]>) -> Result<Self, Error>
fn parse(src: impl AsRef<[u8]>) -> Result<Self, Error>
Parses an UUID from arbitrary bytes.
Errors
This function returns Err
if:
- The length of
src
doesn’t match any UUID format variants. - The content of
src
is invalid.
sourcefn parse_simple(src: impl AsRef<[u8]>) -> Result<Self, Error>
fn parse_simple(src: impl AsRef<[u8]>) -> Result<Self, Error>
Parses a simple UUID from arbitrary bytes.
Errors
This function returns Err
if:
- The length of
src
doesn’t match the “simple” format. - The content of
src
is invalid.
sourcefn parse_hyphenated(src: impl AsRef<[u8]>) -> Result<Self, Error>
fn parse_hyphenated(src: impl AsRef<[u8]>) -> Result<Self, Error>
Parses a hyphenated UUID from arbitrary bytes.
Errors
This function returns Err
if:
- The length of
src
doesn’t match the “hyphenated” format. - The content of
src
is invalid.
sourcefn format_simple(&self) -> Simple<'_>
fn format_simple(&self) -> Simple<'_>
Returns a fmt adapter with “simple” format.
sourcefn format_hyphenated(&self) -> Hyphenated<'_>
fn format_hyphenated(&self) -> Hyphenated<'_>
Returns a fmt adapter with “hyphenated” format.
Implementations on Foreign Types§
source§impl UuidExt for Uuid
impl UuidExt for Uuid
source§fn parse_simple(src: impl AsRef<[u8]>) -> Result<Self, Error>
fn parse_simple(src: impl AsRef<[u8]>) -> Result<Self, Error>
Available on crate feature
uuid
only.source§fn parse_hyphenated(src: impl AsRef<[u8]>) -> Result<Self, Error>
fn parse_hyphenated(src: impl AsRef<[u8]>) -> Result<Self, Error>
Available on crate feature
uuid
only.source§fn format_simple(&self) -> Simple<'_>
fn format_simple(&self) -> Simple<'_>
Available on crate feature
uuid
only.source§fn format_hyphenated(&self) -> Hyphenated<'_>
fn format_hyphenated(&self) -> Hyphenated<'_>
Available on crate feature
uuid
only.