We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 78edd4f + 8013000 commit 8719f50Copy full SHA for 8719f50
src/libcore/str/mod.rs
@@ -48,6 +48,21 @@ pub trait FromStr: Sized {
48
/// If parsing succeeds, return the value inside `Ok`, otherwise
49
/// when the string is ill-formatted return an error specific to the
50
/// inside `Err`. The error type is specific to implementation of the trait.
51
+ ///
52
+ /// # Examples
53
54
+ /// Basic usage with [`i32`][ithirtytwo], a type that implements `FromStr`:
55
56
+ /// [ithirtytwo]: ../primitive.i32.html
57
58
+ /// ```
59
+ /// use std::str::FromStr;
60
61
+ /// let s = "5";
62
+ /// let x = i32::from_str(s).unwrap();
63
64
+ /// assert_eq!(5, x);
65
66
#[stable(feature = "rust1", since = "1.0.0")]
67
fn from_str(s: &str) -> Result<Self, Self::Err>;
68
}
0 commit comments