dtolnay/serde-yaml

Allow Configuration on Option::None handling

bnheise opened this issue · 1 comments

Currently if you have an optional field in Rust:

struct Something {
  maybe_not_there: Option<String>
}

Something {
  maybe_not_there: None
}

And you serialize it using this crate, you get this:

something
  maybe_not_there: null

However, valid yaml accepts also a tilde, no value at all, or simply omitting the key altogether.

Valid:

something
  maybe_not_there: ~

something
  maybe_not_there:

something

It would be nice if it were possible to configure the desired output.