pub struct Uuid { /* private fields */ }
Implementations§
source§impl Uuid
impl Uuid
pub fn random() -> Self
pub fn from_inner(inner: Uuid) -> Self
pub fn into_inner(self) -> Uuid
sourcepub fn from_bytes(bytes: [u8; 16]) -> Self
pub fn from_bytes(bytes: [u8; 16]) -> Self
Convert an array of bytes in the big endian order into a Uuid
.
sourcepub fn try_from_slice(bytes: &[u8]) -> Option<Self>
pub fn try_from_slice(bytes: &[u8]) -> Option<Self>
Convert a slice of bytes in the big endian order into a Uuid
. Return
None
if there’s not enough bytes in the slice.
sourcepub fn from_tt_uuid(tt: tt_uuid) -> Self
pub fn from_tt_uuid(tt: tt_uuid) -> Self
Convert the tarantool native (little endian) uuid representation into a
Uuid
.
sourcepub fn to_tt_uuid(&self) -> tt_uuid
pub fn to_tt_uuid(&self) -> tt_uuid
Return an array of bytes in tarantool native (little endian) format
sourcepub fn nil() -> Self
pub fn nil() -> Self
The ‘nil UUID’.
The nil UUID is special form of UUID that is specified to have all 128 bits set to zero, as defined in IETF RFC 4122 Section 4.1.7.
Examples
Basic usage:
use uuid::Uuid;
let uuid = Uuid::nil();
assert_eq!(
uuid.to_hyphenated().to_string(),
"00000000-0000-0000-0000-000000000000"
);
sourcepub fn parse_str(input: &str) -> Result<Self, Error>
pub fn parse_str(input: &str) -> Result<Self, Error>
Parses a Uuid
from a string of hexadecimal digits with optional
hyphens.
Any of the formats generated by this module (simple, hyphenated, urn) are supported by this parsing function.
sourcepub const fn to_hyphenated(self) -> Hyphenated
pub const fn to_hyphenated(self) -> Hyphenated
Get a Hyphenated
formatter.
sourcepub const fn to_hyphenated_ref(&self) -> HyphenatedRef<'_>
pub const fn to_hyphenated_ref(&self) -> HyphenatedRef<'_>
Get a borrowed HyphenatedRef
formatter.
sourcepub const fn to_simple_ref(&self) -> SimpleRef<'_>
pub const fn to_simple_ref(&self) -> SimpleRef<'_>
Get a borrowed SimpleRef
formatter.
sourcepub const fn to_urn_ref(&self) -> UrnRef<'_>
pub const fn to_urn_ref(&self) -> UrnRef<'_>
Get a borrowed UrnRef
formatter.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Uuid
impl<'de> Deserialize<'de> for Uuid
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl<L> LuaRead<L> for Uuidwhere
L: AsLua,
impl<L> LuaRead<L> for Uuidwhere
L: AsLua,
source§fn lua_read_at_position(lua: L, index: NonZeroI32) -> ReadResult<Self, L>
fn lua_read_at_position(lua: L, index: NonZeroI32) -> ReadResult<Self, L>
fn n_values_expected() -> i32
fn lua_read_at_maybe_zero_position(
lua: L,
index: i32
) -> Result<Self, (L, WrongType)>where
L: AsLua,
source§impl Ord for Uuid
impl Ord for Uuid
source§impl PartialEq for Uuid
impl PartialEq for Uuid
source§impl PartialOrd for Uuid
impl PartialOrd for Uuid
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more