Skip to content

Commit c47fd73

Browse files
committed
---
yaml --- r: 32345 b: refs/heads/dist-snap c: aefc884 h: refs/heads/master i: 32343: 0a7852b v: v3
1 parent ec7ba1f commit c47fd73

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 07ee2997e6d003d64fe12373faab1e8e9483b0ed
10+
refs/heads/dist-snap: aefc884cf6e1b2efbb6b629689b1daa3ebbd1e38
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/libcore/core.rc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export extfmt;
4949
export rt;
5050
export tuple;
5151
export to_str, to_bytes;
52+
export from_str;
5253
export util;
5354
export dvec, dvec_iter;
5455
export dlist, dlist_iter;
@@ -188,6 +189,7 @@ mod option_iter {
188189
mod result;
189190
mod to_str;
190191
mod to_bytes;
192+
mod from_str;
191193
mod util;
192194

193195
// Data structure modules

branches/dist-snap/src/libcore/int-template.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import T = inst::T;
66
import cmp::{Eq, Ord};
7+
import from_str::FromStr;
78
import num::from_int;
89

910
export min_value, max_value;
@@ -162,6 +163,10 @@ fn parse_buf(buf: &[u8], radix: uint) -> Option<T> {
162163
/// Parse a string to an int
163164
fn from_str(s: &str) -> Option<T> { parse_buf(str::to_bytes(s), 10u) }
164165

166+
impl T : FromStr {
167+
static fn from_str(s: &str) -> Option<T> { from_str(s) }
168+
}
169+
165170
/// Convert to a string in a given base
166171
fn to_str(n: T, radix: uint) -> ~str {
167172
do to_str_bytes(n, radix) |slice| {

branches/dist-snap/src/libcore/uint-template.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import T = inst::T;
66
import cmp::{Eq, Ord};
7+
import from_str::FromStr;
78

89
export min_value, max_value;
910
export min, max;
@@ -145,6 +146,10 @@ fn parse_buf(buf: &[const u8], radix: uint) -> Option<T> {
145146
/// Parse a string to an int
146147
fn from_str(s: &str) -> Option<T> { parse_buf(str::to_bytes(s), 10u) }
147148

149+
impl T : FromStr {
150+
static fn from_str(s: &str) -> Option<T> { from_str(s) }
151+
}
152+
148153
/// Parse a string as an unsigned integer.
149154
fn from_str_radix(buf: &str, radix: u64) -> Option<u64> {
150155
if str::len(buf) == 0u { return None; }

0 commit comments

Comments
 (0)