diff options
| author | Corey Richardson <corey@octayn.net> | 2013-09-05 00:48:48 -0400 |
|---|---|---|
| committer | Corey Richardson <corey@octayn.net> | 2013-09-05 00:48:48 -0400 |
| commit | be43625082bf14f7ca49c9edc4b8a899fd73eddf (patch) | |
| tree | 5b56a567af6973c9f50e4a4f4b9b88c92ab5616a /src/libstd/from_str.rs | |
| parent | b6d825ee567633d917127a91a3f8a98012a24170 (diff) | |
| download | rust-be43625082bf14f7ca49c9edc4b8a899fd73eddf.tar.gz rust-be43625082bf14f7ca49c9edc4b8a899fd73eddf.zip | |
Add a from_str function that calls out to the associated method on the trait
Diffstat (limited to 'src/libstd/from_str.rs')
| -rw-r--r-- | src/libstd/from_str.rs | 4 |
1 files changed, 4 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) +} |
