I would prefer not to build this into this crate. I don't know of a YAML library for Rust that is designed for preserving comments but for TOML there is tomllib — you may need to look at how they do it and build a YAML library based on their approach.
I'm dealing with a file that has some information annotated within comments. Are there any plans to add preservation of comments to
serde_yaml
?Thank you for the nice library!
P.S.: If someone searches for an immediate solution before this is implemented use
ruamel
for Python. https://pypi.org/project/ruamel.yaml/