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.
TryFrom<{u8, i32}>
Parity
1 parent aab77b1 commit cabb8f9Copy full SHA for cabb8f9
src/key.rs
@@ -1277,6 +1277,24 @@ impl Parity {
1277
}
1278
1279
1280
+/// `Even` for `0`, `Odd` for `1`, error for anything else
1281
+impl TryFrom<i32> for Parity {
1282
+ type Error = InvalidParityValue;
1283
+
1284
+ fn try_from(parity: i32) -> Result<Self, Self::Error> {
1285
+ Self::from_i32(parity)
1286
+ }
1287
+}
1288
1289
1290
+impl TryFrom<u8> for Parity {
1291
1292
1293
+ fn try_from(parity: u8) -> Result<Self, Self::Error> {
1294
+ Self::from_u8(parity)
1295
1296
1297
1298
/// The conversion returns `0` for even parity and `1` for odd.
1299
impl From<Parity> for i32 {
1300
fn from(parity: Parity) -> i32 {
0 commit comments