toml
toml copied to clipboard
Error when serializing enum with struct
Consider the following code:
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize)]
struct Foo {
bar: Baz,
}
#[derive(Deserialize, Serialize)]
enum Baz {
Test(Test)
}
#[derive(Deserialize, Serialize)]
struct Test {
name: String,
}
fn main() {
let string = std::fs::read_to_string("test.toml").unwrap();
let foo: Foo = toml_edit::de::from_str(&string).unwrap();
toml_edit::ser::to_string(&foo).unwrap();
}
with the following test.toml
:
bar = { Test = { name = "asdf" } }
Deserialization works, but serialization panics with
called `Result::unwrap()` on an `Err` value: Error { kind: UnsupportedType }
I wonder if #321 is related
#405 might also be related