Add LowerHex and UpperHex formatting

This commit is contained in:
Colin Davidson 2016-01-16 21:52:47 -08:00
parent 010f562a62
commit 80c4d01b7f
1 changed files with 12 additions and 0 deletions

View File

@ -242,6 +242,18 @@ impl fmt::Display for BigUint {
}
}
impl fmt::LowerHex for BigUint {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.to_str_radix(16))
}
}
impl fmt::UpperHex for BigUint {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.to_str_radix(16).to_uppercase())
}
}
impl FromStr for BigUint {
type Err = ParseBigIntError;