Skip to main content

deserialize

Function deserialize 

Source
pub fn deserialize<'de, T, D>(deserializer: D) -> Result<T, D::Error>
where T: Deserialize<'de> + FromStr, <T as FromStr>::Err: Display, D: Deserializer<'de>,
Expand description

Deserialize a value that may arrive as a string or a native JSON type.

When the input is a string the value is parsed via FromStr; otherwise the value is forwarded to T’s own deserializer.

§Errors

Returns a deserialization error if the string cannot be parsed or if the native value cannot be deserialized as T.