Skip to content

Instantly share code, notes, and snippets.

@jamesmunns
Last active June 3, 2022 14:20
Show Gist options
  • Save jamesmunns/5bf6dbdcf4d8a5884fc0f5e74a13dbfb to your computer and use it in GitHub Desktop.
Save jamesmunns/5bf6dbdcf4d8a5884fc0f5e74a13dbfb to your computer and use it in GitHub Desktop.
#[derive(Schema)]
enum Inner {
Alpha,
Beta,
Gamma,
Delta(i32, i16),
}
#[derive(Schema)]
struct Outer {
a: u32,
b: u64,
c: u8,
d: Inner,
e: [u8; 10],
}
const OUTER_HUMAN2: &str = "\
Struct { # Outer
[ varint(u32) ], # Outer.a
[ varint(u64) ], # Outer.b
[ u8 ], # Outer.c
[ Enum: # Outer.d
| oneof: [ varint(0) ] # Inner::Alpha
| oneof: [ varint(1) ] # Inner::Beta
| oneof: [ varint(2) ] # Inner::Gamma
| oneof: [ varint(3) ][ varint(i32) ][ varint(i16) ] # Inner::Delta
],
[ u8 ][ u8 ][ u8 ][ u8 ][ u8 ][ u8 ][ u8 ][ u8 ][ u8 ][ u8 ] # Outer.e
}
";
const INNER_HUMAN2: &str = "\
Enum: # Inner
| oneof: [ varint(0) ] # Inner::Alpha
| oneof: [ varint(1) ] # Inner::Beta
| oneof: [ varint(2) ] # Inner::Gamma
| oneof: [ varint(3) ][ varint(i32) ][ varint(i16) ] # Inner::Delta
";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment