Derive Macro codegen::FromSaved

source ·
#[derive(FromSaved)]
{
    // Attributes available to this derive:
    #[substrate]
}
Expand description

Generates an implementation of FromSaved<Sim, Analysis> for a type.

All fields of the type must implement FromSaved. Unit structs are not supported. Enums that do not embed a field in at least one variant are also not supported.

§Examples

#[derive(Debug, Clone, FromSaved)]
#[allow(unused)]
pub enum SavedEnum {
    Fields {
        vout: tran::Voltage,
        iout: tran::Current,
    },
    Tuple(tran::Voltage, tran::Current),
    Unit,
}

#[derive(Debug, Clone, FromSaved)]
#[allow(unused)]
pub struct NamedFields {
    vout: tran::Voltage,
    iout: tran::Current,
}

#[derive(Debug, Clone, FromSaved)]
#[allow(unused)]
pub struct NewType(NamedFields);

#[derive(Debug, Clone, FromSaved)]
#[allow(unused)]
pub struct Tuple(NamedFields, SavedEnum);