hifa_yaserde_derive

Crates.iohifa_yaserde_derive
lib.rshifa_yaserde_derive
version
sourcesrc
created_at2024-05-07 05:11:52.510683+00
updated_at2025-04-24 20:25:36.602725+00
descriptionSerialization and deserialization macros
homepagehttps://github.com/hifa-lang/yaserde
repositoryhttps://github.com/hifa-lang/yaserde
max_upload_size
id1231838
Cargo.toml error:TOML parse error at line 21, column 1 | 21 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Kazuki Kurota (kurotakazuki)

documentation

https://docs.rs/hifa_lang_yaserde

README

Hifa Yaserde   Latest Version

Yet Another Serializer/Deserializer specialized for XML

This is a modified version of the project in media-io/yaserde.

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 hifa_yaserde::de::Deserializer<R>) -> Result<Self, String> {
    // deserializer code
  }
}

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

cargo fmt