Struct bson::uuid::Uuid [−][src]
pub struct Uuid { /* fields omitted */ }
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.
This is supported on crate feature uuid-0_8
only.
uuid-0_8
only.Create a Uuid
from a uuid::Uuid
from
the uuid
crate.
This is supported on crate feature uuid-0_8
only.
uuid-0_8
only.Convert this Uuid
to a uuid::Uuid
from
the uuid
crate.
Trait Implementations
Deserialize this value from the given Serde deserializer. Read more
impl<'de> DeserializeAs<'de, Uuid> for Uuid
This is supported on crate features uuid-0_8
and serde_with
only.
impl<'de> DeserializeAs<'de, Uuid> for Uuid
uuid-0_8
and serde_with
only.Deserialize this value from the given Serde deserializer.
fn serialize_as<S>(source: &Uuid, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
fn serialize_as<S>(source: &Uuid, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer,
Serialize this value into the given Serde serializer.
Auto Trait Implementations
impl RefUnwindSafe for Uuid
impl UnwindSafe for Uuid
Blanket Implementations
Mutably borrows from an owned value. Read more