Derive Macro async_proto::Protocol [−][src]
#[derive(Protocol)]
Implements the Protocol
trait for this type.
The network representation is very simple:
- For
enum
s, it starts with a singleu8
representing the variant, starting with0
for the first variant declared and so on. - Then follow the
Protocol
representations of any fields of thestruct
or variant, in the order declared.
This representation can waste bandwidth for some types, e.g. struct
s with multiple bool
fields. For those, you may want to implement Protocol
manually.
Compile errors
- This macro can’t be used with
union
s. - This macro currently can’t be used with
enum
s with more thanu8::MAX
variants.