uuid::serde

Module simple

Source
Expand description

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

§Example

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

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

Functions§