Implement std::error::Error::source for bip152

During the recent merge of bip152 we ended up with a Rust 1.29 version
of the `error::Error`.

Implement `source` inline with our new MSRV.
This commit is contained in:
Tobin C. Harding 2022-07-28 11:57:14 +10:00
parent a37ab82503
commit 613f1cf2d5
1 changed files with 10 additions and 1 deletions

View File

@ -38,7 +38,16 @@ impl fmt::Display for Error {
}
#[cfg(feature = "std")]
impl error::Error for Error {}
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
use self::Error::*;
match *self {
UnknownVersion | InvalidPrefill => None,
}
}
}
/// A [PrefilledTransaction] structure is used in [HeaderAndShortIds] to
/// provide a list of a few transactions explicitly.