sigp / superstruct

Rust library for versioned data types
https://sigp.github.io/superstruct/
Apache License 2.0
65 stars 3 forks source link

Generate Into<*Ref> for references to variants #2

Closed michaelsproul closed 2 years ago

michaelsproul commented 3 years ago
// FIXME(altair): generate these impls in superstruct
impl<'a, T: EthSpec> From<&'a BeaconStateBase<T>> for BeaconStateRef<'a, T> {
    fn from(inner: &BeaconStateBase<T>) -> Self {
        BeaconStateRef::Base(inner)
    }
}

impl<'a, T: EthSpec> From<&'a BeaconStateAltair<T>> for BeaconStateRef<'a, T> {
    fn from(inner: &BeaconStateAltair<T>) -> Self {
        BeaconStateRef::Altair(inner)
    }
}