reword Option::as_ref and Option::map examples
This commit is contained in:
parent
80a96467ec
commit
74e7709485
1 changed files with 6 additions and 6 deletions
|
@ -608,10 +608,10 @@ impl<T> Option<T> {
|
|||
///
|
||||
/// # 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 @@ impl<T> Option<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…
Add table
Add a link
Reference in a new issue