pub fn bool_from_str<'de, D>(deserializer: D) -> Result<bool, D::Error>
where
    D: Deserializer<'de>,
{
    match String::deserialize(deserializer)?.to_lowercase().as_str() {
        "t" | "true" | "1" | "on" | "y" | "yes" => Ok(true),
        "f" | "false" | "0" | "off" | "n" | "no" => Ok(false),
        other => Err(de::Error::invalid_value(
            Unexpected::Str(other),
            &"Must be truthy (t, true, 1, on, y, yes) or falsey (f, false, 0, off, n, no)",
        )),
    }
}
/// Converts a string to a boolean based on truthy and falsy values
Converts a string to a boolean based on truthy and falsy values
Converts a string to a boolean based on truthy and falsy values
pub fn bool_from_str<'de, D>(deserializer: D) -> Result<bool, D::Error>
where
    D: Deserializer<'de>,
{
    match String::deserialize(deserializer)?.to_lowercase().as_str() {
        "t" | "true" | "1" | "on" | "y" | "yes" => Ok(true),
        "f" | "false" | "0" | "off" | "n" | "no" => Ok(false),
        other => Err(de::Error::invalid_value(
            Unexpected::Str(other),
            &"Must be truthy (t, true, 1, on, y, yes) or falsey (f, false, 0, off, n, no)",
        )),
    }
}
pub fn bool_from_str < ' de , D > ( deserializer : D ) -> Result < bool , D :: Error > where D : Deserializer < ' de > , { match String :: deserialize ( deserializer ) ? . to_lowercase ( ) . as_str ( ) { " " | " " | " " | " " | " " | " " => Ok ( true ) , " " | " " | " " | " " | " " | " " => Ok ( false ) , other => Err ( de :: Error :: invalid_value ( Unexpected :: Str ( other ) , & " " , ) ) , } }
Converts a string to a boolean based on truthy and falsy values
Converts a string to a boolean based on truthy and falsy values
deserializer
D
deserializer
D