mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-24 23:08:36 +01:00
Impl display for invoice fields
This commit is contained in:
parent
6e40e5f18a
commit
3fbfde360f
1 changed files with 15 additions and 0 deletions
|
@ -269,6 +269,15 @@ pub enum Bolt11InvoiceDescription<'f> {
|
|||
Hash(&'f Sha256),
|
||||
}
|
||||
|
||||
impl<'f> Display for Bolt11InvoiceDescription<'f> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Bolt11InvoiceDescription::Direct(desc) => write!(f, "{}", desc.0),
|
||||
Bolt11InvoiceDescription::Hash(hash) => write!(f, "{}", hash.0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a signed [`RawBolt11Invoice`] with cached hash. The signature is not checked and may be
|
||||
/// invalid.
|
||||
///
|
||||
|
@ -1526,6 +1535,12 @@ impl Deref for Description {
|
|||
}
|
||||
}
|
||||
|
||||
impl Display for Description {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<PublicKey> for PayeePubKey {
|
||||
fn from(pk: PublicKey) -> Self {
|
||||
PayeePubKey(pk)
|
||||
|
|
Loading…
Add table
Reference in a new issue