Skip to main content

DeclaredFields

Derive Macro DeclaredFields 

Source
#[derive(DeclaredFields)]
{
    // Attributes available to this derive:
    #[declared]
}
Expand description

Rebuilds the same wire type using declared fields, recursively dropping extension bags without reading, cloning, or serializing them. Mark a bag with #[declared(extension)]; #[serde(flatten)] rest is also recognized. Formal JSON fields are preserved. This derive does not change serde behavior. An alternate protocol crate path can be supplied with #[declared(crate = "path")]. #[declared(bound = "T: path::DeclaredFields")] replaces inferred formal-field bounds, for example for mutually recursive generic types. Existing where clauses and extension-field Default bounds are retained.