Update toml field without modifying the rest

Is there any structured toml reader/writer that can handle preserving comments between reads and writes? (I want to load a toml file, update its version, and then save it again).

I assume there isn't, but before I go the "process the file line by line" route I just want to make sure.

I've noticed that cargo-edit preserves comments in the past, there seems to be issue #15 where comment preservation was tracked, I'm uncertain the extent to which that is reusable, etc though.

1 Like