Add unchecked variant
This variant is supplied in cases where a Result type does not need to be handled.
This commit is contained in:
parent
d75a26aa69
commit
fdf3336ed5
|
@ -723,6 +723,7 @@ pub const fn bitcoin_units::SignedAmount::checked_rem(self, rhs: i64) -> core::o
|
|||
pub const fn bitcoin_units::SignedAmount::checked_sub(self, rhs: bitcoin_units::SignedAmount) -> core::option::Option<bitcoin_units::SignedAmount>
|
||||
pub const fn bitcoin_units::SignedAmount::from_int_btc_const(whole_bitcoin: i64) -> bitcoin_units::SignedAmount
|
||||
pub const fn bitcoin_units::SignedAmount::from_sat(satoshi: i64) -> bitcoin_units::SignedAmount
|
||||
pub const fn bitcoin_units::SignedAmount::from_sat_unchecked(satoshi: i64) -> bitcoin_units::SignedAmount
|
||||
pub const fn bitcoin_units::SignedAmount::to_sat(self) -> i64
|
||||
pub const fn bitcoin_units::block::BlockHeight::from_u32(inner: u32) -> Self
|
||||
pub const fn bitcoin_units::block::BlockHeight::to_u32(self) -> u32
|
||||
|
|
|
@ -674,6 +674,7 @@ pub const fn bitcoin_units::SignedAmount::checked_rem(self, rhs: i64) -> core::o
|
|||
pub const fn bitcoin_units::SignedAmount::checked_sub(self, rhs: bitcoin_units::SignedAmount) -> core::option::Option<bitcoin_units::SignedAmount>
|
||||
pub const fn bitcoin_units::SignedAmount::from_int_btc_const(whole_bitcoin: i64) -> bitcoin_units::SignedAmount
|
||||
pub const fn bitcoin_units::SignedAmount::from_sat(satoshi: i64) -> bitcoin_units::SignedAmount
|
||||
pub const fn bitcoin_units::SignedAmount::from_sat_unchecked(satoshi: i64) -> bitcoin_units::SignedAmount
|
||||
pub const fn bitcoin_units::SignedAmount::to_sat(self) -> i64
|
||||
pub const fn bitcoin_units::block::BlockHeight::from_u32(inner: u32) -> Self
|
||||
pub const fn bitcoin_units::block::BlockHeight::to_u32(self) -> u32
|
||||
|
|
|
@ -656,6 +656,7 @@ pub const fn bitcoin_units::SignedAmount::checked_rem(self, rhs: i64) -> core::o
|
|||
pub const fn bitcoin_units::SignedAmount::checked_sub(self, rhs: bitcoin_units::SignedAmount) -> core::option::Option<bitcoin_units::SignedAmount>
|
||||
pub const fn bitcoin_units::SignedAmount::from_int_btc_const(whole_bitcoin: i64) -> bitcoin_units::SignedAmount
|
||||
pub const fn bitcoin_units::SignedAmount::from_sat(satoshi: i64) -> bitcoin_units::SignedAmount
|
||||
pub const fn bitcoin_units::SignedAmount::from_sat_unchecked(satoshi: i64) -> bitcoin_units::SignedAmount
|
||||
pub const fn bitcoin_units::SignedAmount::to_sat(self) -> i64
|
||||
pub const fn bitcoin_units::block::BlockHeight::from_u32(inner: u32) -> Self
|
||||
pub const fn bitcoin_units::block::BlockHeight::to_u32(self) -> u32
|
||||
|
|
|
@ -83,6 +83,15 @@ impl SignedAmount {
|
|||
/// ```
|
||||
pub const fn to_sat(self) -> i64 { self.0 }
|
||||
|
||||
/// Constructs a new [`SignedAmount`] with satoshi precision and the given number of satoshis.
|
||||
///
|
||||
/// Caller to guarantee that `satoshi` is within valid range.
|
||||
///
|
||||
/// See [`Self::MIN`] and [`Self::MAX_MONEY`].
|
||||
pub const fn from_sat_unchecked(satoshi: i64) -> SignedAmount {
|
||||
SignedAmount(satoshi)
|
||||
}
|
||||
|
||||
/// Converts from a value expressing a decimal number of bitcoin to a [`SignedAmount`].
|
||||
///
|
||||
/// # Errors
|
||||
|
|
Loading…
Reference in New Issue