Apply suggestions from code review

Co-authored-by: Daira Emma Hopwood <daira@jacaranda.org>
This commit is contained in:
Kris Nuttycombe 2023-10-24 12:38:31 -06:00 committed by Kris Nuttycombe
parent f7527e14c9
commit 9cd60c536e
1 changed files with 4 additions and 2 deletions

View File

@ -282,7 +282,8 @@ impl NonNegativeAmount {
Self::from_u64(amount) Self::from_u64(amount)
} }
/// Reads a NonNegativeAmount from a signed 64-bit little-endian integer. /// Reads a NonNegativeAmount from a signed integer represented as a two's
/// complement 64-bit little-endian value.
/// ///
/// Returns an error if the amount is outside the range `{0..MAX_MONEY}`. /// Returns an error if the amount is outside the range `{0..MAX_MONEY}`.
pub fn from_nonnegative_i64_le_bytes(bytes: [u8; 8]) -> Result<Self, ()> { pub fn from_nonnegative_i64_le_bytes(bytes: [u8; 8]) -> Result<Self, ()> {
@ -290,7 +291,8 @@ impl NonNegativeAmount {
Self::from_nonnegative_i64(amount) Self::from_nonnegative_i64(amount)
} }
/// Returns this NonNegativeAmount encoded as a signed 64-bit little-endian integer. /// Returns this NonNegativeAmount encoded as a signed two's complement 64-bit
/// little-endian value.
pub fn to_i64_le_bytes(self) -> [u8; 8] { pub fn to_i64_le_bytes(self) -> [u8; 8] {
self.0.to_i64_le_bytes() self.0.to_i64_le_bytes()
} }