Go to file
2023-12-19 21:49:53 +01:00
.github Upgrade to GitHub-native Dependabot 2021-04-29 20:50:51 +00:00
doc Documentation fix 2023-02-17 08:05:54 +00:00
examples Reexport yaserde_derive macros when derive feature is enabled 2023-02-18 14:45:02 +01:00
yaserde Fix tests 2023-10-30 23:54:24 +01:00
yaserde_derive Evaluate serialization conditions also for Struct, Vec and Enum 2022-12-28 10:42:43 +01:00
.gitignore Handle default ns prefix 2021-09-12 20:34:11 +03:00
.travis.yml add new rust version for CI 2021-05-30 19:31:04 +02:00
Cargo.toml improve contribution to add examples, fix some clippy warns 2021-02-08 14:10:08 +01:00
Changelog.md add Changelog 2021-05-31 12:33:04 +02:00
LICENSE Initial commit 2018-04-09 19:00:25 +02:00
README.md #139 Adding documentation for skip_serializing 2022-04-07 12:28:47 +02: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: Exclude this field from the serialized output. More details...
  • skip_serializing_if: Skip the serialisation for this field if the condition is true. More details...
  • 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
  }
}