Skip to main content

AltiumBase

Derive Macro AltiumBase 

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

Derive macro for Altium base types.

Generates HasXxxBase traits for composition-based inheritance.

§Attributes

  • #[altium(base_name = "Name")] - Name for generated trait (default: struct name)
  • #[altium(extends = "ParentBase")] - Parent base type for trait inheritance

§Example

#[derive(AltiumBase)]
#[altium(base_name = "SchPrimitiveBase")]
pub struct SchPrimitiveBase {
    #[altium(param = "OWNERINDEX", default)]
    pub owner_index: i32,
}

#[derive(AltiumBase)]
#[altium(base_name = "SchGraphicalBase", extends = "SchPrimitiveBase")]
pub struct SchGraphicalBase {
    #[altium(flatten)]
    pub base: SchPrimitiveBase,

    #[altium(param = "LOCATION.X", frac = "LOCATION.X_FRAC")]
    pub location_x: i32,
}