[−][src]Macro ethox::enum_with_unknown
Define an enumeration with known variants and an unknown representation.
Most network protocols define fields where not all bit-patterns are standardized values. In some cases these are invalid while others allocate them through some registrar (such as IANA). This macro makes it more ergonomic to define a representation for such fields by providing converters to and from an underlying representation derived from the definition.
Example
enum_with_unknown! { pub enum IpVersion(u8) { IpV4 = 4, IpV6 = 6, } }