macro_rules! impl_writeable_tlv_based_enum_upgradable { ($st: ident, $(($variant_id: expr, $variant_name: ident) => {$(($type: expr, $field: ident, $fieldty: tt)),* $(,)*} ),* $(,)* $(; $(($tuple_variant_id: expr, $tuple_variant_name: ident)),* $(,)*)*) => { ... }; }
Expand description
Implement MaybeReadable
and Writeable
for an enum, with struct variants stored as TLVs and
tuple variants stored directly.
This is largely identical to impl_writeable_tlv_based_enum
, except that odd variants will
return Ok(None)
instead of Err(
DecodeError::UnknownRequiredFeature
)
. It should generally be preferred
when MaybeReadable
is practical instead of just Readable
as it provides an upgrade path for
new variants to be added which are simply ignored by existing clients.
Note that only struct and unit variants (not tuple variants) will support downgrading, thus any
new odd variants MUST be non-tuple (i.e. described using $variant_id
and $variant_name
not
$tuple_variant_id
and $tuple_variant_name
).