mitsuhiko / deser

Experimental rust serialization library
https://docs.rs/deser
Apache License 2.0
287 stars 8 forks source link

Add Support for Enum Struct Variants #21

Open mitsuhiko opened 2 years ago

mitsuhiko commented 2 years ago

Similar to serde it should be possible to serializer and deserialize enums with structs in them. There are two cases to cover:

Newtype pattern:

struct A {
  a: bool
}

struct B {
  b: bool
}

enum Foo {
  A(A),
  B(B),
}

Embedded struct variant pattern:

enum Foo {
  A { a: bool },
  B { b: bool },
}

Either of them should likely work the same. This issue relates to the question of buffering and state (#20).