Skip to main content

derive_deftly_template_SerdeStringOrTransparent

Macro derive_deftly_template_SerdeStringOrTransparent 

Source
macro_rules! derive_deftly_template_SerdeStringOrTransparent {
    ({ $($driver:tt)* } [$($aoptions:tt)*] ($($future:tt)*) $($tpassthrough:tt)*) => { ... };
    ($($wrong:tt)*) => { ... };
}
Expand description

Define Serialize and Deserialize via string rep or transparently, depending

In human-readable formats, uses the Display and FromStr. In non-human-readable formats, serialises as the single field.

Uses serde’s is_human_readable to decide. structs which don’t have exactly one field will cause a compile error.

This is a derive_deftly template. Do not invoke it directly. To use it, write: #[derive(Deftly)] #[derive_deftly(SerdeStringOrTransparent)].