Expand description
Serialize a Uuid as a byte string.
Unlike compact, which serializes a Uuid as a
[u8; 16] array, this module uses the serializer’s dedicated byte string
support through serialize_bytes. Formats that distinguish byte strings
from sequences, such as CBOR or MessagePack, can then encode the Uuid as
a single 16 byte string instead of a sequence of 16 individually encoded
integers.
§Examples
#[derive(serde_derive::Serialize, serde_derive::Deserialize)]
struct Container {
#[serde(with = "uuid::serde::bytes")]
id: Uuid,
}Functions§
- deserialize
- Deserialize a byte string as a
Uuid. - serialize
- Serialize from a
Uuidas a byte string.