#[derive(Serializer)]
{
// Attributes available to this derive:
#[serializer]
}
Expand description
Derive [rustango::serializer::ModelSerializer] for a struct.
§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)].