Struct bson::Uuid

source · []
pub struct Uuid { /* private fields */ }
Expand description

A struct modeling a BSON UUID value (i.e. a Binary value with subtype 4).

This type should be used instead of uuid::Uuid when serializing to or deserializing from BSON, since uuid::Uuid’s serde implementation doesn’t produce or parse BSON UUIDs.

To enable interop with the Uuid type from the uuid crate, enable the uuid-0_8 feature flag.

For more information on the usage of this type, see the uuid module-level documentation.

Note: due to an issue in serde (see here), this type will also allow deserialization from 16 byte + subtype 0 Binary values in BSON if part of a #[serde(flatten)] chain. This behavior shouldn’t be relied upon as it may be fixed at some point in the future.

Implementations

Creates a random UUID.

This uses the operating system’s RNG as the source of random numbers. If you’d like to use a custom generator, generate random bytes and pass them to Uuid::from_bytes instead.

Creates a Uuid using the supplied big-endian bytes.

Creates a Uuid from the provided hex string.

Returns an array of 16 bytes containing the Uuid’s data.

Available on crate feature uuid-0_8 only.

Create a Uuid from a uuid::Uuid from the uuid crate.

Available on crate feature uuid-0_8 only.

Convert this Uuid to a uuid::Uuid from the uuid crate.

Available on crate feature uuid-1 only.

Create a Uuid from a uuid::Uuid from the uuid crate.

Available on crate feature uuid-1 only.

Convert this Uuid to a uuid::Uuid from the uuid crate.

Trait Implementations

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

Deserialize this value from the given Serde deserializer.

Deserialize this value from the given Serde deserializer.

Formats the value using the given formatter. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

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

Serialize this value into the given Serde serializer.

Serialize this value into the given Serde serializer.

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

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

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.