-
The peer, written and ossified long ago into backwards-compatibility with other components, expects to see a |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It is not possible to combine two such transformations on a single value. You will need to write your own types and transformation code. You can copy most of fn visit_str<E>(self, s: &str) -> Result<Self::Value, E>
where
E: serde::de::Error,
{
match s {
"0" => Ok(false),
"1" => Ok(true),
unexp => Err(serde::de::Error::invalid_value(
Unexpected::Str(unexp),
&"\"0\" or \"1\"",
)),
}
} |
Beta Was this translation helpful? Give feedback.
It is not possible to combine two such transformations on a single value. You will need to write your own types and transformation code. You can copy most of
BoolFromInt
. The transformation code would be something like this: