Skip to main content

deserialize_lenient_bool

Function deserialize_lenient_bool 

Source
pub fn deserialize_lenient_bool<'de, D>(
    deserializer: D,
) -> Result<Option<bool>, D::Error>
where D: Deserializer<'de>,
Expand description

Deserializes an optional boolean that may arrive spelled as a string.

Null reads as None. A boolean reads as itself and a string as true only when it spells true in any letter case; every other value reads as false, so a malformed value neither passes for true nor fails the enclosing value.