Closed
Description
I want to serialize a Option<String>
to unflatten self close element like <Foo><option-with-none-value/></Foo>
. Is there any way to control it?
Code:
#[derive(Debug, Deserialize, Serialize, PartialEq)]
pub struct Foo {
#[serde(rename = "$unflatten=option-with-none-value")]
pub body: Option<String>,
}
to_string(&Foo { body: None }).unwrap()
Result:
<Foo><option-with-none-value></option-with-none-value></Foo>