Function default_on_error

Source
pub fn default_on_error<'de, D, T>(deserializer: D) -> Result<T, D::Error>
Expand description

Helper function for returning a default value if deserialization of the type fails.

Assumes that the content being deserialized is JSON.

Used as #[serde(deserialize_with = "default_on_error")].