feat(serde): Enable serialization & deserialization for Template*#35
feat(serde): Enable serialization & deserialization for Template*#35grenewode wants to merge 2 commits intofizyr:mainfrom
Template*#35Conversation
- [x] Implement `serde::Serialize` and `serde::Deserialize` for `Template`, `TemplateBuf`, `ByteTemplate` and `ByteTemplateBuf` - [x] Add `serde` feature to crate, to control implementation of `serde::Serialize` and `serde::Deserialize` - [x] make `json`, `toml` and `yaml` features respect `serde` feature
|
Thanks! I think this makes sense. I think the implementation could be simplified a bit though. Rather than defining visitors you can just deserialize into a Will save us a ton of code :) |
src/template/mod.rs
Outdated
| } | ||
| } | ||
|
|
||
| impl std::cmp::Eq for Template<'_> {} |
There was a problem hiding this comment.
The Eq can also be derived.
|
I've simplified the implementations a bit by getting rid of custom visitors where possible. I kept one for I don't want to use I don't know of a great alternative now though. For deserializing there's Also, there is nothing equivalent for serializing. |
serde::Serializeandserde::DeserializeforTemplate,TemplateBuf,ByteTemplateandByteTemplateBufserdefeature to crate, to control implementation ofserde::Serializeandserde::Deserializejson,tomlandyamlfeatures respectserdefeature