Struct lolid::Uuid[][src]

#[repr(transparent)]
pub struct Uuid { /* fields omitted */ }
Expand description

Universally unique identifier, consisting of 128-bits, as according to RFC4122

Implementations

Creates zero UUID

Creates new Uuid from raw bytes.

Creates new Uuid from byte slice, if its size is 16, otherwise None

Creates UUID from GUID converting integer fields to big endian while d4 is copied as it is.

Note that it is assumed that GUID was correctly created in little endian format (e.g. using winapi CoCreateGuid which internally uses UuidCreate which in turn relies on secure random) Effectively winapi GUID would result in creation of UUID of Random variant.

Access underlying bytes as slice.

Get underlying raw bytes

Returns time_low part of uuid.

Refer to https://en.wikipedia.org/wiki/Universally_unique_identifier#Format

Returns time_mid part of uuid.

Refer to https://en.wikipedia.org/wiki/Universally_unique_identifier#Format

Returns time_high_and_version part of uuid.

Refer to https://en.wikipedia.org/wiki/Universally_unique_identifier#Format

Returns clock_sequence part of uuid.

Refer to https://en.wikipedia.org/wiki/Universally_unique_identifier#Format

Returns node part of uuid.

Refer to https://en.wikipedia.org/wiki/Universally_unique_identifier#Format

Checks if UUID version is equal to the provided version

Checks if UUID variant is set, only cares about RFC4122 byte

Generates UUID from time and mac address

Generates UUID v3 by using md5 hasher

Only available when md5 feature is enabled.

Constructs UUID v4 from provided bytes, assuming they are random.

It is up to user to guarantee that it is random.

This function only sets corresponding bits for v4

Generates UUID v4 using OS RNG from getrandom

Only available when osrng feature is enabled.

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

Generates UUID v5 by using sha1 hasher

Only available when sha1 feature is enabled.

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.

Adds version byte to the corresponding field.

Useful when user is supplied with random bytes, and wants to create UUID from it.

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.

Creates new instance by parsing provided string.

Supports only simple sequence of characters and - separated.

Creates textual representation of UUID in a static buffer.

Trait Implementations

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.