#enums #macro-derive #miniserde #serialization #deserialize

macro miniserde-derive-enum

Derive macros for miniserde that support enums

2 releases

0.1.1 Oct 21, 2019
0.1.0 Oct 21, 2019

#5 in #miniserde

MIT/Apache

17KB
401 lines

miniserde-derive-enum

Crates.io License Downloads

Miniserde derive macros that support enums.

Provides a minimal Serialize_enum, Deserialize_enum derive macros for enum support in Miniserde.

Example

use miniserde::{Serialize, Deserialize};
use miniserde_derive_enum::{Serialize_enum, Deserialize_enum};

pub fn main() {
   #[derive(Serialize_enum, Deserialize_enum)]
   enum E {
       Unit,
       Struct { a: u8, b: String, c: Box<E> },
       Tuple(u8, String),
   }
}

License: MIT OR Apache-2.0


lib.rs:

Miniserde derive macros that support enums.

Provides a minimal Serialize_enum, Deserialize_enum derive macros for enum support in Miniserde.

Example

use miniserde_derive_enum::{Serialize_enum, Deserialize_enum};

pub fn main() {
   #[derive(Serialize_enum, Deserialize_enum)]
   enum E {
       Unit,
       Struct { a: u8, b: String, c: Box<E> },
       Tuple(u8, String),
   }
}

Dependencies

~1.5MB
~37K SLoC