-
-
Save stevenroose/f47e6e63f63c1922b938bc50c9f8e64f to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn fmt_value_in(&self, f: &mut fmt::Write, denom: Denomination) -> fmt::Result { | |
let sats = match self.as_sat().checked_abs() { | |
Some(sats) => sats, | |
None => { | |
assert_eq!(self.as_sats(), i64::min_value()); | |
2147483648 // u64::max_value() - self.as_sat() as u64 + 1 | |
} | |
}; | |
fmt_satoshi_in(sats, self.is_negative(), f, denom) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment