From 65790b67189745471e60606c622cd97b7314cedc Mon Sep 17 00:00:00 2001 From: Jeffrey Czyz Date: Wed, 6 Nov 2024 11:11:11 -0600 Subject: [PATCH] Add Description::empty constructor When creating a default Bolt11InvoiceParameters, having an infallible constructor avoids an unwrap. --- lightning-invoice/src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lightning-invoice/src/lib.rs b/lightning-invoice/src/lib.rs index 9f049deb7..6f7ec2253 100644 --- a/lightning-invoice/src/lib.rs +++ b/lightning-invoice/src/lib.rs @@ -1600,6 +1600,11 @@ impl Description { } } + /// Creates an empty `Description`. + pub fn empty() -> Self { + Description(UntrustedString(String::new())) + } + /// Returns the underlying description [`UntrustedString`] pub fn into_inner(self) -> UntrustedString { self.0 -- 2.39.5