Derive Macro codegen::DerivedLayers
source · #[derive(DerivedLayers)]
{
// Attributes available to this derive:
#[layer_family]
}
Expand description
Derives a derived layer set implementation on a struct.
§Examples
#[derive(DerivedLayers)]
pub struct DerivedLayers {
#[layer_family]
m1: M1,
m2: M2,
}
#[derive(DerivedLayerFamily, Clone, Copy)]
pub struct M1 {
#[layer(primary)]
pub drawing: M1Drawing,
#[layer(pin)]
pub pin: M1Pin,
#[layer(label)]
pub label: M1Label,
}
impl From<&PdkLayers<ExamplePdkA>> for DerivedLayers {
fn from(value: &PdkLayers<ExamplePdkA>) -> Self {
Self {
m1: M1 {
drawing: M1Drawing::new(value.met1a.drawing),
pin: M1Pin::new(value.met1a.pin),
label: M1Label::new(value.met1a.label),
},
m2: M2::new(value.met2a),
}
}
}
impl From<&PdkLayers<ExamplePdkB>> for DerivedLayers {
fn from(value: &PdkLayers<ExamplePdkB>) -> Self {
Self {
m1: M1 {
drawing: M1Drawing::new(value.met1b.drawing),
pin: M1Pin::new(value.met1b.pin),
label: M1Label::new(value.met1b.label),
},
m2: M2::new(value.met2b),
}
}
}