]> git.lizzy.rs Git - rust.git/commitdiff
Add example for from_str_radix
authorSteve Klabnik <steve@steveklabnik.com>
Mon, 18 May 2015 20:58:29 +0000 (16:58 -0400)
committerSteve Klabnik <steve@steveklabnik.com>
Mon, 18 May 2015 21:13:59 +0000 (17:13 -0400)
Fixes #25517

src/libcore/num/mod.rs

index 011830ddb7882d65da98c0c14b481cf6700e32ac..75040b4c425c68c3962165314ff4c1e15d4ff664 100644 (file)
@@ -132,15 +132,11 @@ pub fn max_value() -> $T {
         ///
         /// Leading and trailing whitespace represent an error.
         ///
-        /// # Arguments
-        ///
-        /// * src - A string slice
-        /// * radix - The base to use. Must lie in the range [2 .. 36]
-        ///
-        /// # Return value
+        /// # Examples
         ///
-        /// `Err(ParseIntError)` if the string did not represent a valid number.
-        /// Otherwise, `Ok(n)` where `n` is the integer represented by `src`.
+        /// ```
+        /// assert_eq!(u32::from_str_radix("A", 16), Some(10));
+        /// ```
         #[stable(feature = "rust1", since = "1.0.0")]
         #[allow(deprecated)]
         pub fn from_str_radix(src: &str, radix: u32) -> Result<$T, ParseIntError> {