A Rust library for XML serialization and deserialization with attribute-driven configuration.
Yaserde is a Rust library for serializing and deserializing data to and from XML. It solves the problem of mapping Rust structs and enums to XML documents with support for XML-specific features like attributes, namespaces, and text nodes, using a declarative attribute-based configuration.
Rust developers working with XML data formats, such as those building APIs, data pipelines, or tools that consume or produce XML in environments like embedded systems (no_std) or web services.
Developers choose Yaserde for its specialized focus on XML with robust attribute-driven configuration, eliminating manual XML parsing/writing while supporting advanced XML features that generic serialization libraries may not handle.
Yet Another Serializer/Deserializer
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses Rust attributes like #[yaserde(rename = '...')] to define XML mappings declaratively, reducing boilerplate parsing code as shown in the attribute examples in the README.
Handles XML-specific elements such as namespaces, attributes, text content, and flattened elements, covering advanced schemas without manual implementation.
Allows implementing YaDeserialize and YaSerialize traits for full control over serialization logic, enabling custom handling for specialized formats as demonstrated in the code snippets.
Supports structs, enums with complex types, vectors, options, and primitives, making it versatile for mapping various Rust data structures to XML.
Requires predefined Rust structs, which can be cumbersome for dynamic or schema-less XML where data structures are not known at compile time, limiting flexibility.
Compared to serde-based XML libraries like serde_xml-rs, Yaserde has a smaller user base and fewer third-party integrations, potentially affecting long-term support and tooling.
The attribute-based approach can lead to verbose code when dealing with many fields or complex mappings, increasing maintenance overhead and potential for errors.