]> git.lizzy.rs Git - rust.git/blobdiff - library/core/src/num/dec2flt/mod.rs
Add missing code examples in libcore
[rust.git] / library / core / src / num / dec2flt / mod.rs
index ed6202bb82f0fc45e7c4a9605353f7436f2e7a13..6f3a3a867450db0d9e3cf6ee1e9c3127bed0cd22 100644 (file)
@@ -166,6 +166,16 @@ fn from_str(src: &str) -> Result<Self, ParseFloatError> {
 ///
 /// This error is used as the error type for the [`FromStr`] implementation
 /// for [`f32`] and [`f64`].
+///
+/// # Example
+///
+/// ```
+/// use std::str::FromStr;
+///
+/// if let Err(e) = f64::from_str("a.12") {
+///     println!("Failed conversion to f64: {}", e);
+/// }
+/// ```
 #[derive(Debug, Clone, PartialEq, Eq)]
 #[stable(feature = "rust1", since = "1.0.0")]
 pub struct ParseFloatError {