Fix witness_version leaf error type
Leaf error types should typically have private fields, provide accessor functions, and not use `non_exhaustive`.
This commit is contained in:
parent
2af764e859
commit
43c5eb765c
|
@ -245,10 +245,14 @@ impl From<TryFromError> for TryFromInstructionError {
|
||||||
|
|
||||||
/// Error attempting to create a [`WitnessVersion`] from an integer.
|
/// Error attempting to create a [`WitnessVersion`] from an integer.
|
||||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||||
#[non_exhaustive]
|
|
||||||
pub struct TryFromError {
|
pub struct TryFromError {
|
||||||
/// The invalid non-witness version integer.
|
/// The invalid non-witness version integer.
|
||||||
pub invalid: u8,
|
invalid: u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TryFromError {
|
||||||
|
/// Returns the invalid non-witness version integer.
|
||||||
|
pub fn invalid_version(&self) -> u8 { self.invalid }
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for TryFromError {
|
impl fmt::Display for TryFromError {
|
||||||
|
@ -258,6 +262,4 @@ impl fmt::Display for TryFromError {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl std::error::Error for TryFromError {
|
impl std::error::Error for TryFromError {}
|
||||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue