Go to file
Jonas Platte 12ddcdbc87
Use absolute paths in generated code
With this, the derives should work with most of the crates and types
the generated code refers to being aliased.

Notably, methods are still mostly invoked using regular method syntax
so those coming from trait could still be aliased by outside code.
2020-12-17 17:50:16 +01:00
yaserde Use absolute paths in generated code 2020-12-17 17:50:16 +01:00
yaserde_derive Use absolute paths in generated code 2020-12-17 17:50:16 +01:00
.gitignore ignore a couple extra "target" directories 2020-06-19 21:58:05 -07:00
.travis.yml update cache strategy on Travis, add rust 1.43 and 1.44 2020-06-08 10:54:25 +02:00
Cargo.toml remove undefined project 2018-05-15 20:01:55 +02:00
LICENSE Initial commit 2018-04-09 19:00:25 +02:00
README.md bump to 0.3.13 2020-02-25 15:34:44 +01:00
rustfmt.toml add fmt definition 2018-05-23 17:14:42 +02:00

yaserde Build Status Latest Version Coverage Status

Yet Another Serializer/Deserializer specialized for XML

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)

Attributes

  • attribute: this field is defined as an attribute
  • default: defines the default function to init the field
  • flatten: Flatten the contents of the field
  • namespace: defines the namespace of the field
  • rename: be able to rename a field
  • root: rename the based element. Used only at the XML root.
  • skip_serializing_if: Skip the serialisation for this field if the condition is true
  • text: this field match to the text content

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
  }
}