Derive Macro async_proto::Protocol [−][src]
#[derive(Protocol)]Expand description
Implements the Protocol trait for this type.
The network representation is very simple:
- Attempting to read an
enumwith no variants errors immediately, without waiting for data to appear on the stream. - For non-empty
enums, the representation starts with the discriminant (a number representing the variant), starting with0for the first variant declared and so on. - Then follow the
Protocolrepresentations of any fields of thestructor variant, in the order declared.
This representation can waste bandwidth for some types, e.g. structs with multiple bool fields. For those, you may want to implement Protocol manually.
Compile errors
- This macro can’t be used with
unions. - This macro currently can’t be used with generics.