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.
1 parent 78c4d53 commit 8221715Copy full SHA for 8221715
src/libcore/option.rs
@@ -409,9 +409,11 @@ impl<T> Option<T> {
409
/// Convert an `Option<String>` into an `Option<usize>`, consuming the original:
410
///
411
/// ```
412
- /// let num_as_str: Option<String> = Some("10".to_string());
413
- /// // `Option::map` takes self *by value*, consuming `num_as_str`
414
- /// let num_as_int: Option<usize> = num_as_str.map(|n| n.len());
+ /// let maybe_some_string = Some(String::from("Hello, World!"));
+ /// // `Option::map` takes self *by value*, consuming `maybe_some_string`
+ /// let maybe_some_len = maybe_some_string.map(|s| s.len());
415
+ ///
416
+ /// assert_eq!(maybe_some_len, Some(13));
417
418
#[inline]
419
#[stable(feature = "rust1", since = "1.0.0")]
0 commit comments