units: Deprecate unchecked ops
These functions do not add value because one can just call `to_sat` and `from_sat` if doing ops in a tight loop. Note we need to remove these deprecated functions before we release `units v1.0`.
This commit is contained in:
parent
4d0f80f1fc
commit
b895c9aad4
|
@ -318,6 +318,7 @@ impl SignedAmount {
|
|||
///
|
||||
/// On overflow, panics in debug mode, wraps in release mode.
|
||||
#[must_use]
|
||||
#[deprecated(since = "TBD", note = "consider converting to u64 using `to_sat`")]
|
||||
pub fn unchecked_add(self, rhs: SignedAmount) -> SignedAmount { Self(self.0 + rhs.0) }
|
||||
|
||||
/// Unchecked subtraction.
|
||||
|
@ -328,6 +329,7 @@ impl SignedAmount {
|
|||
///
|
||||
/// On overflow, panics in debug mode, wraps in release mode.
|
||||
#[must_use]
|
||||
#[deprecated(since = "TBD", note = "consider converting to u64 using `to_sat`")]
|
||||
pub fn unchecked_sub(self, rhs: SignedAmount) -> SignedAmount { Self(self.0 - rhs.0) }
|
||||
|
||||
/// Subtraction that doesn't allow negative [`SignedAmount`]s.
|
||||
|
|
|
@ -394,6 +394,7 @@ impl Amount {
|
|||
///
|
||||
/// On overflow, panics in debug mode, wraps in release mode.
|
||||
#[must_use]
|
||||
#[deprecated(since = "TBD", note = "consider converting to u64 using `to_sat`")]
|
||||
pub fn unchecked_add(self, rhs: Amount) -> Amount { Self(self.0 + rhs.0) }
|
||||
|
||||
/// Unchecked subtraction.
|
||||
|
@ -404,6 +405,7 @@ impl Amount {
|
|||
///
|
||||
/// On overflow, panics in debug mode, wraps in release mode.
|
||||
#[must_use]
|
||||
#[deprecated(since = "TBD", note = "consider converting to u64 using `to_sat`")]
|
||||
pub fn unchecked_sub(self, rhs: Amount) -> Amount { Self(self.0 - rhs.0) }
|
||||
|
||||
/// Converts to a signed amount.
|
||||
|
|
Loading…
Reference in New Issue