We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Parity
1 parent 8bf2927 commit 662843eCopy full SHA for 662843e
src/key.rs
@@ -1292,13 +1292,16 @@ impl<'de> ::serde::Deserialize<'de> for Parity {
1292
type Value = Parity;
1293
1294
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
1295
- formatter.write_str("Expecting a 4 byte int i32")
+ formatter.write_str("32-bit integer with value 0 or 1")
1296
}
1297
1298
fn visit_i32<E>(self, v: i32) -> Result<Self::Value, E>
1299
where E: ::serde::de::Error
1300
{
1301
- Parity::from_i32(v).map_err(E::custom)
+ use serde::de::Unexpected;
1302
+
1303
+ Parity::from_i32(v)
1304
+ .map_err(|_| E::invalid_value(Unexpected::Signed(v.into()), &"0 or 1"))
1305
1306
1307
0 commit comments