about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/from_str.rs4
-rw-r--r--src/libstd/prelude.rs1
2 files changed, 5 insertions, 0 deletions
diff --git a/src/libstd/from_str.rs b/src/libstd/from_str.rs
index d2f1a895e1e..a2417ae70cc 100644
--- a/src/libstd/from_str.rs
+++ b/src/libstd/from_str.rs
@@ -19,3 +19,7 @@ pub trait FromStr {
     /// string is ill-formatted, the None is returned.
     fn from_str(s: &str) -> Option<Self>;
 }
+
+pub fn from_str<A: FromStr>(s: &str) -> Option<A> {
+    FromStr::from_str(s)
+}
diff --git a/src/libstd/prelude.rs b/src/libstd/prelude.rs
index 8f202ee8531..9cdf7af091f 100644
--- a/src/libstd/prelude.rs
+++ b/src/libstd/prelude.rs
@@ -41,6 +41,7 @@ pub use result::{Result, Ok, Err};
 // Reexported functions
 pub use io::{print, println};
 pub use iterator::range;
+pub use from_str::from_str;
 
 // Reexported types and traits
 pub use c_str::ToCStr;