Skip to content

Commit 7e932e0

Browse files
committed
f - remove Option from some Offer method return values
1 parent a8fae6d commit 7e932e0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lightning/src/offers/offer.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub(crate) struct OfferContents {
4343
metadata: Option<Vec<u8>>,
4444
amount: Option<Amount>,
4545
description: String,
46-
features: Option<OfferFeatures>,
46+
features: OfferFeatures,
4747
absolute_expiry: Option<Duration>,
4848
issuer: Option<String>,
4949
paths: Option<Vec<BlindedPath>>,
@@ -73,13 +73,13 @@ impl Offer {
7373
}
7474

7575
/// A complete description of the purpose of the payment.
76-
pub fn description(&self) -> &String {
76+
pub fn description(&self) -> &str {
7777
&self.contents.description
7878
}
7979

8080
/// Features for paying the invoice.
81-
pub fn features(&self) -> Option<&OfferFeatures> {
82-
self.contents.features.as_ref()
81+
pub fn features(&self) -> &OfferFeatures {
82+
&self.contents.features
8383
}
8484

8585
/// Duration since the Unix epoch when an invoice should no longer be requested.
@@ -102,13 +102,13 @@ impl Offer {
102102
}
103103

104104
/// The issuer of the offer, possibly beginning with `user@domain` or `domain`.
105-
pub fn issuer(&self) -> Option<&String> {
106-
self.contents.issuer.as_ref()
105+
pub fn issuer(&self) -> Option<&str> {
106+
self.contents.issuer.as_ref().map(|issuer| issuer.as_str())
107107
}
108108

109109
/// Paths to the recipient originating from publicly reachable nodes.
110-
pub fn paths(&self) -> Option<&Vec<BlindedPath>> {
111-
self.contents.paths.as_ref()
110+
pub fn paths(&self) -> &[BlindedPath] {
111+
self.contents.paths.as_ref().map(|paths| paths.as_slice()).unwrap_or(&[])
112112
}
113113

114114
/// The minimum quantity of items supported.

0 commit comments

Comments
 (0)