diff --git a/README.md b/README.md index 3c0e796..f38b295 100644 --- a/README.md +++ b/README.md @@ -19,3 +19,25 @@ This library will support XML de/ser-ializing with all specific features. - [x] **attribute**: this field is defined as an attribute - [x] **text**: this field match to the text content - [ ] **namespace**: defines the namespace of the field + +## 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 + } +} +```