mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 14:31:55 +00:00
Implements Default trait for BigInt and BigUint
This commit is contained in:
parent
a390b5dd03
commit
655487b596
@ -19,6 +19,7 @@ A `BigInt` is a combination of `BigUint` and `Sign`.
|
||||
use Integer;
|
||||
|
||||
use std::cmp;
|
||||
use std::default::Default;
|
||||
use std::fmt;
|
||||
use std::from_str::FromStr;
|
||||
use std::num::CheckedDiv;
|
||||
@ -112,6 +113,11 @@ impl TotalOrd for BigUint {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for BigUint {
|
||||
#[inline]
|
||||
fn default() -> BigUint { BigUint::new(Vec::new()) }
|
||||
}
|
||||
|
||||
impl fmt::Show for BigUint {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f.buf, "{}", self.to_str_radix(10))
|
||||
@ -830,6 +836,11 @@ impl TotalOrd for BigInt {
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for BigInt {
|
||||
#[inline]
|
||||
fn default() -> BigInt { BigInt::new(Zero, Vec::new()) }
|
||||
}
|
||||
|
||||
impl fmt::Show for BigInt {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f.buf, "{}", self.to_str_radix(10))
|
||||
|
Loading…
Reference in New Issue
Block a user