pub fn none_as_empty_string<T, S>(
value: &Option<T>,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
T: Serialize,
S: Serializer,
Expand description
Serde serializiation decorator to map None
to an empty String
,
and forward Some
s to the Serialize
implementation for T
.
To be used like this:
#[serde(serialize_with = "empty_string_as_none")]