#[derive(Serializer)]
{
// Attributes available to this derive:
#[serializer]
}
Expand description
Derive rustango::serializer::ModelSerializer for a struct.
(intra-doc link disabled — the macro crate doesn’t depend on
rustango itself, so rustdoc can’t resolve the path.)
§Container attribute (required)
#[serializer(model = TypeName)] — the Model type this serializer maps from.
§Field attributes
#[serializer(read_only)]— mapped from model; included in JSON output; excluded fromwritable_fields()#[serializer(write_only)]—Default::default()infrom_model; excluded from JSON output; included inwritable_fields()#[serializer(source = "field_name")]— reads frommodel.field_nameinstead ofmodel.<field_ident>#[serializer(skip)]—Default::default()infrom_model; included in JSON output; excluded fromwritable_fields()(user sets manually)
The macro also emits a custom impl serde::Serialize — do not also #[derive(Serialize)].