Skip to main content

gen_struct_with_per_field_attrs

Function gen_struct_with_per_field_attrs 

Source
pub fn gen_struct_with_per_field_attrs(
    typ: &TypeDef,
    mapper: &dyn TypeMapper,
    cfg: &RustBindingConfig<'_>,
    extra_field_attrs: impl Fn(&FieldDef) -> Vec<String>,
) -> String
Expand description

Generate a struct definition using the builder, with a per-field attribute callback.

extra_field_attrs is called for each field and returns additional #[...] attributes to prepend (beyond cfg.field_attrs). Pass |_| vec![] to use the default behaviour.