about summary refs log tree commit diff
path: root/src/libcore/uint-template.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore/uint-template.rs')
-rw-r--r--src/libcore/uint-template.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs
index dfab2e36096..cf4abe4e16f 100644
--- a/src/libcore/uint-template.rs
+++ b/src/libcore/uint-template.rs
@@ -4,6 +4,7 @@
 
 import T = inst::T;
 import cmp::{Eq, Ord};
+import from_str::FromStr;
 
 export min_value, max_value;
 export min, max;
@@ -145,6 +146,10 @@ fn parse_buf(buf: &[const u8], radix: uint) -> Option<T> {
 /// Parse a string to an int
 fn from_str(s: &str) -> Option<T> { parse_buf(str::to_bytes(s), 10u) }
 
+impl T : FromStr {
+    static fn from_str(s: &str) -> Option<T> { from_str(s) }
+}
+
 /// Parse a string as an unsigned integer.
 fn from_str_radix(buf: &str, radix: u64) -> Option<u64> {
     if str::len(buf) == 0u { return None; }