reword Option::as_ref and Option::map examples
This commit is contained in:
parent
80a96467ec
commit
74e7709485
@ -608,10 +608,10 @@ pub const fn is_none(&self) -> bool {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, preserving
|
||||
/// the original. The [`map`] method takes the `self` argument by value, consuming the original,
|
||||
/// so this technique uses `as_ref` to first take an `Option` to a reference
|
||||
/// to the value inside the original.
|
||||
/// Calculates the length of an <code>Option<[String]></code> as an <code>Option<[usize]></code>
|
||||
/// without moving the [`String`]. The [`map`] method takes the `self` argument by value,
|
||||
/// consuming the original, so this technique uses `as_ref` to first take an `Option` to a
|
||||
/// reference to the value inside the original.
|
||||
///
|
||||
/// [`map`]: Option::map
|
||||
/// [String]: ../../std/string/struct.String.html "String"
|
||||
@ -902,8 +902,8 @@ pub const fn unwrap_or_default(self) -> T
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// Converts an <code>Option<[String]></code> into an <code>Option<[usize]></code>, consuming
|
||||
/// the original:
|
||||
/// Calculates the length of an <code>Option<[String]></code> as an
|
||||
/// <code>Option<[usize]></code>, consuming the original:
|
||||
///
|
||||
/// [String]: ../../std/string/struct.String.html "String"
|
||||
/// ```
|
||||
|
Loading…
Reference in New Issue
Block a user