-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vec
s containing Option
types are removed from output
#603
Comments
The issue seems to be here The let value = value.serialize(super::ValueSerializer {}).map_err(|e| {
if let Error::UnsupportedNone = e {
Error::UnsupportedType(Some("None is unsupported in vectors"))
} else {
e
}
})?; But supporting |
There are two different ways to look at this bug The first is that we should be skipping The other is that we should more generally error. I lean towards erroring because gaps may be significant and we wouldn't be able to represent that
In the enum case, there is a meaningful way of defining "gaps" based on the definition of your enum. With options, there isn't any. |
If a vector contains an option type, and any of its entries are
None
, the vector is completely removed from the output. I believe this is becausetoml
tries not to output anything forNone
values, but this chokes when trying to insert a gap with nothing in it.If you create an enum with the same structure as
Option
,toml
uses a different format that correctly handles "gaps" (shown in the below example); I believe this should be used for vectors of options.Example on Rust Playground
The text was updated successfully, but these errors were encountered: