remove trailing whitespace
This commit is contained in:
parent
44f3bee17f
commit
d5a4c6253d
1 changed files with 15 additions and 15 deletions
|
@ -816,7 +816,7 @@ mod loop_keyword { }
|
||||||
/// be handled exhaustively either explicitly or by using wildcards like
|
/// be handled exhaustively either explicitly or by using wildcards like
|
||||||
/// `_` in the `match`. Since `match` is an expression values can also be
|
/// `_` in the `match`. Since `match` is an expression values can also be
|
||||||
/// returned.
|
/// returned.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// let opt = Option::None::<usize>;
|
/// let opt = Option::None::<usize>;
|
||||||
/// let x = match opt {
|
/// let x = match opt {
|
||||||
|
@ -824,7 +824,7 @@ mod loop_keyword { }
|
||||||
/// None => 10,
|
/// None => 10,
|
||||||
/// }
|
/// }
|
||||||
/// assert_eq!(x, 10);
|
/// assert_eq!(x, 10);
|
||||||
///
|
///
|
||||||
/// let a_number = Option::Some(10);
|
/// let a_number = Option::Some(10);
|
||||||
/// match a_number {
|
/// match a_number {
|
||||||
/// Some(x) if x <= 5 => println!("0 to 5 num = {}", x),
|
/// Some(x) if x <= 5 => println!("0 to 5 num = {}", x),
|
||||||
|
@ -833,17 +833,17 @@ mod loop_keyword { }
|
||||||
/// _ => all_other_numbers(),
|
/// _ => all_other_numbers(),
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// `match` can be used to gain access to the inner members of an enum
|
/// `match` can be used to gain access to the inner members of an enum
|
||||||
/// and use them directly.
|
/// and use them directly.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// enum Outer {
|
/// enum Outer {
|
||||||
/// Double(Option<u8>, Option<String>),
|
/// Double(Option<u8>, Option<String>),
|
||||||
/// Single(Option<u8>),
|
/// Single(Option<u8>),
|
||||||
/// Empty
|
/// Empty
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// let get_inner = Outer::Double(None, Some(String::new()));
|
/// let get_inner = Outer::Double(None, Some(String::new()));
|
||||||
/// match get_inner {
|
/// match get_inner {
|
||||||
/// Outer::Double(None, Some(st)) => println!("{}", st),
|
/// Outer::Double(None, Some(st)) => println!("{}", st),
|
||||||
|
@ -851,9 +851,9 @@ mod loop_keyword { }
|
||||||
/// _ => the_rest(),
|
/// _ => the_rest(),
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// For more information on `match` and matching in general, see the [Reference].
|
/// For more information on `match` and matching in general, see the [Reference].
|
||||||
///
|
///
|
||||||
/// [Reference]: ../reference/expressions/match-expr.html
|
/// [Reference]: ../reference/expressions/match-expr.html
|
||||||
mod match_keyword { }
|
mod match_keyword { }
|
||||||
|
|
||||||
|
@ -874,29 +874,29 @@ mod mod_keyword { }
|
||||||
/// `move` converts any variables captured by reference or mutable reference
|
/// `move` converts any variables captured by reference or mutable reference
|
||||||
/// to owned by value variables. The three [`Fn` trait]'s mirror the ways to capture
|
/// to owned by value variables. The three [`Fn` trait]'s mirror the ways to capture
|
||||||
/// variables, when `move` is used the closures is represented by the `FnOnce` trait.
|
/// variables, when `move` is used the closures is represented by the `FnOnce` trait.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// let capture = "hello";
|
/// let capture = "hello";
|
||||||
/// let closure = move || {
|
/// let closure = move || {
|
||||||
/// println!("we say {}", capture);
|
/// println!("we say {}", capture);
|
||||||
/// };
|
/// };
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// `move` is often used when [threads] are involved.
|
/// `move` is often used when [threads] are involved.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// let x = 5;
|
/// let x = 5;
|
||||||
///
|
///
|
||||||
/// std::thread::spawn(move || {
|
/// std::thread::spawn(move || {
|
||||||
/// println!("captured {} by value", x)
|
/// println!("captured {} by value", x)
|
||||||
/// }).join().unwrap();
|
/// }).join().unwrap();
|
||||||
///
|
///
|
||||||
/// // x is no longer available
|
/// // x is no longer available
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// For more information on the `move` keyword, see the [closure]'s section
|
/// For more information on the `move` keyword, see the [closure]'s section
|
||||||
/// of the Rust book or the [threads] section
|
/// of the Rust book or the [threads] section
|
||||||
///
|
///
|
||||||
/// [`Fn` trait]: ../std/ops/trait.Fn.html
|
/// [`Fn` trait]: ../std/ops/trait.Fn.html
|
||||||
/// [closure]: ../book/ch13-01-closures.html
|
/// [closure]: ../book/ch13-01-closures.html
|
||||||
/// [threads]: ../book/ch16-01-threads.html#using-move-closures-with-threads
|
/// [threads]: ../book/ch16-01-threads.html#using-move-closures-with-threads
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue