Skip to main content

try_from_str

Function try_from_str 

Source
pub fn try_from_str<'de, D: Deserializer<'de>, T: FromStr>(
    deserializer: D,
) -> Result<Option<T>, D::Error>
Expand description

Try to deserialize a type using its FromStr implementation, fallback to None if it doesn’t work.

§Errors

If a string cannot be parsed from the deserializer.