macro_rules! protocol {
(
$( $( #[ doc = $sdoc:literal ] )*
struct $name:ident <$lt:lifetime> $(: $super:ident)? { $($struct:tt)+ }
)+
$( #[repr($repr:ty)] $( #[ doc = $edoc:literal ] )*
enum $ename:ident { $($(#[$default:meta])? $emname:ident = $emvalue:literal),+ $(,)? }
)*
) => { ... };
}
Expand description
Generates a protocol definition from a Rust-like DSL.
LIMITATION: Enums must appear after structs.
struct Foo {
bar: u8,
baz: u16 = 123,
}
#[repr(u8)]
enum MyEnum {
A = 1,
B = 2,
}