File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -1277,6 +1277,24 @@ impl Parity {
12771277 }
12781278}
12791279
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+
12801298/// The conversion returns `0` for even parity and `1` for odd.
12811299impl From < Parity > for i32 {
12821300 fn from ( parity : Parity ) -> i32 {
Original file line number Diff line number Diff line change @@ -372,8 +372,7 @@ impl fmt::Display for Error {
372372#[ cfg( feature = "std" ) ]
373373#[ cfg_attr( docsrs, doc( cfg( feature = "std" ) ) ) ]
374374impl 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 ) > {
377376 match self {
378377 Error :: IncorrectSignature => None ,
379378 Error :: InvalidMessage => None ,
You can’t perform that action at this time.
0 commit comments