Module uuid::serde::urn

source ·
Expand description

Serialize from a Uuid as a uuid::fmt::Urn

§Example

#[derive(serde_derive::Serialize, serde_derive::Deserialize)]
struct StructA {
    // This will change both serailization and deserialization
    #[serde(with = "uuid::serde::urn")]
    id: uuid::Uuid,
}

#[derive(serde_derive::Serialize, serde_derive::Deserialize)]
struct StructB {
    // This will be serialized as uuid::fmt::Urn and deserialize from all valid formats
    #[serde(serialize_with = "uuid::serde::urn::serialize")]
    id: uuid::Uuid,
}

Functions§