Display for PoolType

This commit is contained in:
Matthew Watt 2023-10-08 19:19:51 -05:00
parent 94f2240e08
commit 46ed4964c3
2 changed files with 12 additions and 2 deletions

View File

@ -2,7 +2,7 @@
use std::{
collections::{BTreeMap, HashMap},
fmt::Debug,
fmt::{self, Debug},
io,
num::{NonZeroU32, TryFromIntError},
};
@ -604,6 +604,16 @@ pub enum PoolType {
Shielded(ShieldedProtocol),
}
impl fmt::Display for PoolType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
PoolType::Transparent => f.write_str("Transparent"),
PoolType::Shielded(ShieldedProtocol::Sapling) => f.write_str("Sapling"),
PoolType::Shielded(ShieldedProtocol::Orchard) => f.write_str("Orchard"),
}
}
}
/// A type that represents the recipient of a transaction output; a recipient address (and, for
/// unified addresses, the pool to which the payment is sent) in the case of outgoing output, or an
/// internal account ID and the pool to which funds were sent in the case of a wallet-internal

View File

@ -149,7 +149,7 @@ impl fmt::Display for SqliteClientError {
SqliteClientError::CommitmentTree(err) => write!(f, "An error occurred accessing or updating note commitment tree data: {}.", err),
SqliteClientError::CacheMiss(height) => write!(f, "Requested height {} does not exist in the block cache.", height),
SqliteClientError::ChainHeightUnknown => write!(f, "Chain height unknown; please call `update_chain_tip`"),
SqliteClientError::UnsupportedPoolType(t) => write!(f, "Pool type is not currently supported: {:?}", t)
SqliteClientError::UnsupportedPoolType(t) => write!(f, "Pool type is not currently supported: {}", t)
}
}
}