How can I use yaml tags with serde YAML, does it supports it?
like:
field1: &tag
- item
field2: *tag
I've tried using references, but couldn't figure out the lifetimes and std::rc:Rc<>
violates the ownership requirements Deserialize
has
How can I use yaml tags with serde YAML, does it supports it?
like:
field1: &tag
- item
field2: *tag
I've tried using references, but couldn't figure out the lifetimes and std::rc:Rc<>
violates the ownership requirements Deserialize
has
Support for YAML tags and aliases in serde-yaml is serviceable but not fully featured. It will deserialize using the tags by simply duplicating the data, but it will not serialize with tags. The crate's primary job is to serve as an adapter between YAML and serde's data model which does not support aliasing.
In Issue #177: enable support for tags when serializing, dtolnay responds:
I think I would prefer not to build this into this crate. There is room for someone to build a more featureful YAML emitter which would expose this sort of thing.
There are certainly other yaml-related crates, though I do not know which ones can preserve or allow you to encode aliases.
© 2022 - 2024 — McMap. All rights reserved.
field1
's contents intofield2
, correct? – Okie