chyh1990 / yaml-rust

A pure rust YAML implementation.
Apache License 2.0
601 stars 138 forks source link

Support generation of YAML with comments #181

Open jrandall opened 2 years ago

jrandall commented 2 years ago

Address half of #146 by adding support to generate YAML with comments. Parsing YAML with comments into the internal form (and making round-tripping possible) would be the next step, but we had an immediate need on the generation side so we went ahead and implemented that, and hope that it might be useful to others as well.

Because we don't have a parser yet, the tests for comment generation are somewhat verbose (involving literal expected values). Once the parser is implemented, these tests can be replaced by round-trip tests as are used for much of the other functionality.