logo
pub fn none_as_empty_string<T: Serialize, S>(
    value: &Option<T>,
    serializer: S
) -> Result<S::Ok, S::Error> where
    S: Serializer
Expand description

Serde serializiation decorator to map None to an empty String, and forward Somes to the Serialize implementation for T.

To be used like this: #[serde(serialize_with = "empty_string_as_none")]