[−][src]Struct lolid::Uuid
Universally unique identifier, consisting of 128-bits, as according to RFC4122
Implementations
impl Uuid
[src]
pub const fn nil() -> Self
[src]
Creates zero UUID
pub const fn from_bytes(data: [u8; 16]) -> Self
[src]
Creates new Uuid from raw bytes.
pub const fn as_bytes(&self) -> &[u8]
[src]
Access underlying bytes as slice.
pub const fn bytes(&self) -> [u8; 16]
[src]
Get underlying raw bytes
pub const fn is_version(&self, version: Version) -> bool
[src]
Checks if UUID
version is equal to the provided version
pub const fn is_variant(&self) -> bool
[src]
Checks if UUID
variant is set, only cares about RFC4122 byte
pub const fn v1(timestamp: Timestamp, mac: [u8; 6]) -> Self
[src]
Generates UUID from time and mac address
pub fn v4() -> Self
[src]
Generates UUID v4
using OS RNG from getrandom
Only available when osrng
feature is enabled.
pub fn prng() -> Self
[src]
Generates UUID v4
using PRNG from wyhash
Only available when prng
feature is enabled.
This random variant generates predictable UUID, even though they are unique. Which means that each time program starts, it is initialized with the same seed and therefore would repeat UUIDs
This random is useful when you want to generate predictable but unique UUIDs
Otherwise use v4
pub fn v5(namespace: Uuid, name: &[u8]) -> Self
[src]
Generates UUID v5
by using sha1
hasher
Only available when sha1
feature is enabled.
pub const fn set_variant(self) -> Self
[src]
Adds variant byte to the corresponding field.
This implementation only cares about RFC4122, there is no option to set other variant.
Useful when user is supplied with random bytes, and wants to create UUID from it.
pub const fn set_version(self, version: Version) -> Self
[src]
Adds version byte to the corresponding field.
Useful when user is supplied with random bytes, and wants to create UUID from it.
pub fn parse_ascii_bytes(input: &[u8]) -> Result<Self, ParseError>
[src]
Creates new instance by parsing provided bytes.
Use this when you want to avoid performing utf-8 checks and directly feed bytes. As long as supplied bytes contain valid ascii characters it will parse successfully. Otherwise it shall fail with invalid character.
Supports only simple sequence of characters and -
separated.
pub fn parse_str(input: &str) -> Result<Self, ParseError>
[src]
Creates new instance by parsing provided string.
Supports only simple sequence of characters and -
separated.
pub const fn to_str(&self) -> StrBuf<[u8; 36]>
[src]
Creates textual representation of UUID in a static buffer.
Trait Implementations
impl AsRef<[u8]> for Uuid
[src]
impl Clone for Uuid
[src]
impl Copy for Uuid
[src]
impl Debug for Uuid
[src]
impl Default for Uuid
[src]
impl<'de> Deserialize<'de> for Uuid
[src]
fn deserialize<D: Deserializer<'de>>(des: D) -> Result<Self, D::Error>
[src]
impl Display for Uuid
[src]
impl Eq for Uuid
[src]
impl FromStr for Uuid
[src]
type Err = ParseError
The associated error which can be returned from parsing.
fn from_str(input: &str) -> Result<Self, Self::Err>
[src]
impl Hash for Uuid
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Uuid
[src]
fn cmp(&self, other: &Uuid) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Uuid> for Uuid
[src]
impl PartialOrd<Uuid> for Uuid
[src]
fn partial_cmp(&self, other: &Uuid) -> Option<Ordering>
[src]
fn lt(&self, other: &Uuid) -> bool
[src]
fn le(&self, other: &Uuid) -> bool
[src]
fn gt(&self, other: &Uuid) -> bool
[src]
fn ge(&self, other: &Uuid) -> bool
[src]
impl Serialize for Uuid
[src]
impl StructuralEq for Uuid
[src]
impl StructuralPartialEq for Uuid
[src]
Auto Trait Implementations
impl RefUnwindSafe for Uuid
impl Send for Uuid
impl Sync for Uuid
impl Unpin for Uuid
impl UnwindSafe for Uuid
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,