Skip to content

Commit d13b23f

Browse files
Kimundibrson
authored andcommitted
Added ToStrRadix and FromStrRadix traits
1 parent 96f0512 commit d13b23f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libcore/num/num.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
// except according to those terms.
1010

1111
//! An interface for numeric types
12+
use cmp::Eq;
13+
use option::{None, Option, Some};
1214

1315
pub trait Num {
1416
// FIXME: Trait composition. (#2616)
@@ -50,3 +52,11 @@ pub enum RoundMode {
5052
RoundToZero,
5153
RoundFromZero
5254
}
55+
56+
pub trait ToStrRadix {
57+
pub pure fn to_str_radix(&self, radix: uint) -> ~str;
58+
}
59+
60+
pub trait FromStrRadix {
61+
static pub pure fn from_str_radix(str: &str, radix: uint) -> Option<self>;
62+
}

0 commit comments

Comments
 (0)