Add a from_str function that calls out to the associated method on the trait
This commit is contained in:
parent
b6d825ee56
commit
be43625082
2 changed files with 5 additions and 0 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue