about summary refs log tree commit diff
path: root/src/libcore/uint-template.rs
diff options
context:
space:
mode:
authorJesse Jones <jesse9jones@gmail.com>2012-11-17 11:01:08 -0800
committerBrian Anderson <banderson@mozilla.com>2012-11-18 13:25:27 -0800
commit0fd9c9d0547c0f882465596f7cee77286cb8e56b (patch)
tree437ea6e7edb32cb023038c885acda582c9503c87 /src/libcore/uint-template.rs
parent361aea94f2e037139e29a573ce4486c670bacb87 (diff)
Made from_str pure
Diffstat (limited to 'src/libcore/uint-template.rs')
-rw-r--r--src/libcore/uint-template.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs
index ceb525f5f8d..d406e36cc07 100644
--- a/src/libcore/uint-template.rs
+++ b/src/libcore/uint-template.rs
@@ -100,7 +100,7 @@ impl T: iter::Times {
  *
  * `buf` must not be empty
  */
-pub fn parse_bytes(buf: &[const u8], radix: uint) -> Option<T> {
+pub pure fn parse_bytes(buf: &[const u8], radix: uint) -> Option<T> {
     if vec::len(buf) == 0u { return None; }
     let mut i = vec::len(buf) - 1u;
     let mut power = 1u as T;
@@ -117,10 +117,13 @@ pub fn parse_bytes(buf: &[const u8], radix: uint) -> Option<T> {
 }
 
 /// Parse a string to an int
-pub fn from_str(s: &str) -> Option<T> { parse_bytes(str::to_bytes(s), 10u) }
+pub pure fn from_str(s: &str) -> Option<T>
+{
+    parse_bytes(str::to_bytes(s), 10u)
+}
 
 impl T : FromStr {
-    static fn from_str(s: &str) -> Option<T> { from_str(s) }
+    static pure fn from_str(s: &str) -> Option<T> { from_str(s) }
 }
 
 /// Parse a string as an unsigned integer.