Tidy description

Add one space between header and description body
This commit is contained in:
yancy 2024-02-29 15:21:22 +01:00
parent 162094322f
commit e3db95226a
1 changed files with 5 additions and 1 deletions

View File

@ -839,34 +839,38 @@ impl Amount {
// Some arithmetic that doesn't fit in `core::ops` traits. // Some arithmetic that doesn't fit in `core::ops` traits.
/// Checked addition. /// Checked addition.
///
/// Returns [None] if overflow occurred. /// Returns [None] if overflow occurred.
pub fn checked_add(self, rhs: Amount) -> Option<Amount> { pub fn checked_add(self, rhs: Amount) -> Option<Amount> {
self.0.checked_add(rhs.0).map(Amount) self.0.checked_add(rhs.0).map(Amount)
} }
/// Checked subtraction. /// Checked subtraction.
///
/// Returns [None] if overflow occurred. /// Returns [None] if overflow occurred.
pub fn checked_sub(self, rhs: Amount) -> Option<Amount> { pub fn checked_sub(self, rhs: Amount) -> Option<Amount> {
self.0.checked_sub(rhs.0).map(Amount) self.0.checked_sub(rhs.0).map(Amount)
} }
/// Checked multiplication. /// Checked multiplication.
///
/// Returns [None] if overflow occurred. /// Returns [None] if overflow occurred.
pub fn checked_mul(self, rhs: u64) -> Option<Amount> { self.0.checked_mul(rhs).map(Amount) } pub fn checked_mul(self, rhs: u64) -> Option<Amount> { self.0.checked_mul(rhs).map(Amount) }
/// Checked integer division. /// Checked integer division.
///
/// Be aware that integer division loses the remainder if no exact division /// Be aware that integer division loses the remainder if no exact division
/// can be made. /// can be made.
/// Returns [None] if overflow occurred. /// Returns [None] if overflow occurred.
pub fn checked_div(self, rhs: u64) -> Option<Amount> { self.0.checked_div(rhs).map(Amount) } pub fn checked_div(self, rhs: u64) -> Option<Amount> { self.0.checked_div(rhs).map(Amount) }
/// Checked remainder. /// Checked remainder.
///
/// Returns [None] if overflow occurred. /// Returns [None] if overflow occurred.
pub fn checked_rem(self, rhs: u64) -> Option<Amount> { self.0.checked_rem(rhs).map(Amount) } pub fn checked_rem(self, rhs: u64) -> Option<Amount> { self.0.checked_rem(rhs).map(Amount) }
/// Unchecked addition. /// Unchecked addition.
/// ///
///
/// Computes `self + rhs`. Panics in debug mode, wraps in release mode. /// Computes `self + rhs`. Panics in debug mode, wraps in release mode.
pub fn unchecked_add(self, rhs: Amount) -> Amount { pub fn unchecked_add(self, rhs: Amount) -> Amount {
Self(self.0 + rhs.0) Self(self.0 + rhs.0)