From 1d2cfb036cff1088420e42a817b4a672e65e5d4b Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sat, 19 Oct 2024 11:49:14 -0700 Subject: [PATCH] Make `Amount::to_sat` and `SignedAmount::to_sat` const --- units/src/amount.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/units/src/amount.rs b/units/src/amount.rs index ebba49492..aad698b89 100644 --- a/units/src/amount.rs +++ b/units/src/amount.rs @@ -887,7 +887,7 @@ impl Amount { pub const fn from_sat(satoshi: u64) -> Amount { Amount(satoshi) } /// Gets the number of satoshis in this [`Amount`]. - pub fn to_sat(self) -> u64 { self.0 } + pub const fn to_sat(self) -> u64 { self.0 } /// Converts from a value expressing bitcoins to an [`Amount`]. #[cfg(feature = "alloc")] @@ -1313,7 +1313,7 @@ impl SignedAmount { pub const fn from_sat(satoshi: i64) -> SignedAmount { SignedAmount(satoshi) } /// Gets the number of satoshis in this [`SignedAmount`]. - pub fn to_sat(self) -> i64 { self.0 } + pub const fn to_sat(self) -> i64 { self.0 } /// Convert from a value expressing bitcoins to an [`SignedAmount`]. #[cfg(feature = "alloc")]