File tree 2 files changed +19
-2
lines changed
2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -1277,6 +1277,24 @@ impl Parity {
1277
1277
}
1278
1278
}
1279
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
+ /// `Even` for `0`, `Odd` for `1`, error for anything else
1290
+ impl TryFrom < u8 > for Parity {
1291
+ type Error = InvalidParityValue ;
1292
+
1293
+ fn try_from ( parity : u8 ) -> Result < Self , Self :: Error > {
1294
+ Self :: from_u8 ( parity)
1295
+ }
1296
+ }
1297
+
1280
1298
/// The conversion returns `0` for even parity and `1` for odd.
1281
1299
impl From < Parity > for i32 {
1282
1300
fn from ( parity : Parity ) -> i32 {
Original file line number Diff line number Diff line change @@ -372,8 +372,7 @@ impl fmt::Display for Error {
372
372
#[ cfg( feature = "std" ) ]
373
373
#[ cfg_attr( docsrs, doc( cfg( feature = "std" ) ) ) ]
374
374
impl std:: error:: Error for Error {
375
- #[ allow( deprecated) ]
376
- fn cause ( & self ) -> Option < & dyn std:: error:: Error > {
375
+ fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
377
376
match self {
378
377
Error :: IncorrectSignature => None ,
379
378
Error :: InvalidMessage => None ,
You can’t perform that action at this time.
0 commit comments