Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/media-io/yaserde
Yet Another Serializer/Deserializer
https://github.com/media-io/yaserde
Last synced: 3 months ago
JSON representation
Yet Another Serializer/Deserializer
- Host: GitHub
- URL: https://github.com/media-io/yaserde
- Owner: media-io
- License: mit
- Created: 2018-04-09T17:00:24.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T18:44:30.000Z (9 months ago)
- Last Synced: 2024-04-30T08:33:01.409Z (9 months ago)
- Language: Rust
- Size: 492 KB
- Stars: 168
- Watchers: 10
- Forks: 52
- Open Issues: 52
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE
Awesome Lists containing this project
- awesome-rust-cn - media-io/yaserde - ci.org/media-io/yaserde.svg?branch=master">](https://travis-ci.org/media-io/yaserde) (Libraries / Encoding)
- awesome-rust - media-io/yaserde - ci.org/media-io/yaserde.svg?branch=master">](https://travis-ci.org/media-io/yaserde) (Libraries / Encoding)
- awesome-rust - media-io/yaserde
- awesome-rust-cn - media-io/yaserde
- awesome-rust - media-io/yaserde - Yet Another Serializer/Deserializer specialized for XML (Libraries / Encoding)
- awesome-rust - media-io/yaserde - ci.org/media-io/yaserde.svg?branch=master">](https://travis-ci.org/media-io/yaserde) (库 Libraries / 加密 Encoding)
- awesome-rust-zh - media-io/yaserde - 另一个专门用于 XML 的 Serializer / Deserializer(序列化/反序列化) [<img src="https://api.travis-ci.org/media-io/yaserde.svg?branch=master">](https://travis-ci.org/media-io/yaserde) (库 / 编码(Encoding))
- fucking-awesome-rust - media-io/yaserde - Yet Another Serializer/Deserializer specialized for XML (Libraries / Encoding)
- fucking-awesome-rust - media-io/yaserde - Yet Another Serializer/Deserializer specialized for XML (Libraries / Encoding)
README
# yaserde [![Build Status]][travis] [![Latest Version]][crates.io] [![Coverage Status]][coveralls]
[Build Status]: https://travis-ci.com/media-io/yaserde.svg?branch=master
[travis]: https://travis-ci.com/media-io/yaserde
[Latest Version]: https://img.shields.io/crates/v/yaserde.svg
[crates.io]: https://crates.io/crates/yaserde[Coverage Status]: https://coveralls.io/repos/github/media-io/yaserde/badge.svg?branch=master
[coveralls]: https://coveralls.io/github/media-io/yaserde?branch=master**Yet Another Serializer/Deserializer specialized for XML**
## Goal
This library will support XML de/ser-ializing with all specific features.## Supported types
- [x] Struct
- [x] Vec
- [x] Enum
- [x] Enum with complex types
- [x] Option
- [x] String
- [x] bool
- [x] number (u8, i8, u32, i32, f32, f64)## Attributes
- [x] **attribute**: this field is defined as an attribute
- [x] **default**: defines the default function to init the field
- [x] **flatten**: Flatten the contents of the field
- [x] **namespace**: defines the namespace of the field
- [x] **rename**: be able to rename a field
- [x] **root**: rename the based element. Used only at the XML root.
- [x] **skip_serializing**: Exclude this field from the serialized output. [More details...](doc/skip_serializing.md)
- [x] **skip_serializing_if**: Skip the serialisation for this field if the condition is true. [More details...](doc/skip_serializing.md)
- [x] **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```rust
impl YaDeserialize for MyType {
fn deserialize(reader: &mut yaserde::de::Deserializer) -> Result {
// deserializer code
}
}
``````rust
impl YaSerialize for MyType {
fn serialize(&self, writer: &mut yaserde::ser::Serializer) -> Result<(), String> {
// serializer code
}
}
```