Go to file
2018-05-15 19:35:14 +02:00
yaserde add basic type serialisation (bool, char and numbers) 2018-05-15 19:35:14 +02:00
yaserde_derive support de/ser-ialization with namespace 2018-05-13 17:43:36 +02:00
.gitignore Initial commit 2018-04-09 19:00:25 +02:00
.travis.yml add travis configuration 2018-04-09 19:06:04 +02:00
Cargo.toml refactoring code to better support 2018-05-13 09:51:28 +02:00
LICENSE Initial commit 2018-04-09 19:00:25 +02:00
README.md update README 2018-05-13 17:45:23 +02:00

yaserde

Yet Another Serializer/Deserializer

Goal

This library will support XML de/ser-ializing with all specific features.

Supported types

  • Struct
  • Vec
  • Enum
  • Enum with complex types
  • Option
  • String
  • bool
  • number (u8, i8, u32, i32, f32, f64)

Decorators

  • root: rename the based element. Used only at the XML root.
  • rename: be able to rename a field
  • attribute: this field is defined as an attribute
  • text: this field match to the text content
  • namespace: defines the namespace of the field

Custom De/Ser-rializer

Any type can define a custom deserializer and/or serializer. To implement it, define the implementation of YaDeserialize/YaSerialize

impl YaDeserialize for MyType {
  fn deserialize<R: Read>(reader: &mut yaserde::de::Deserializer<R>) -> Result<Self, String> {
    // deserializer code
  }
}

impl YaSerialize for MyType {
  fn serialize<W: Write>(&self, writer: &mut yaserde::ser::Serializer<W>) -> Result<(), String> {
    // serializer code
  }
}