Skip to main content

combine_fields

Attribute Macro combine_fields 

Source
#[combine_fields]
Expand description

Attribute macro that merges fields from other #[derive(Fields)] structs into the annotated struct.

§Example

#[combine_fields(CoreVocabulary, ApplicatorVocabulary)]
#[derive(Debug, Clone, Default)]
pub struct Schema {
    // extra fields defined here
    pub markdown_description: Option<String>,
}

The macro reads cached field definitions (stored by #[derive(Fields)]) and emits the target struct with all fields merged in.

§Panics

Panics if the attribute arguments are not a comma-separated list of identifiers, or if the annotated item is not a struct with named fields.