@@ -816,15 +816,15 @@ mod loop_keyword { }
816
816
/// be handled exhaustively either explicitly or by using wildcards like
817
817
/// `_` in the `match`. Since `match` is an expression values can also be
818
818
/// returned.
819
- ///
819
+ ///
820
820
/// ```rust
821
821
/// let opt = Option::None::<usize>;
822
822
/// let x = match opt {
823
823
/// Some(int) => int,
824
824
/// None => 10,
825
825
/// }
826
826
/// assert_eq!(x, 10);
827
- ///
827
+ ///
828
828
/// let a_number = Option::Some(10);
829
829
/// match a_number {
830
830
/// Some(x) if x <= 5 => println!("0 to 5 num = {}", x),
@@ -833,27 +833,27 @@ mod loop_keyword { }
833
833
/// _ => all_other_numbers(),
834
834
/// }
835
835
/// ```
836
- ///
837
- /// `match` can be used to gain access to the inner members of an enum
836
+ ///
837
+ /// `match` can be used to gain access to the inner members of an enum
838
838
/// and use them directly.
839
- ///
839
+ ///
840
840
/// ```rust
841
841
/// enum Outer {
842
842
/// Double(Option<u8>, Option<String>),
843
843
/// Single(Option<u8>),
844
844
/// Empty
845
845
/// }
846
- ///
846
+ ///
847
847
/// let get_inner = Outer::Double(None, Some(String::new()));
848
848
/// match get_inner {
849
849
/// Outer::Double(None, Some(st)) => println!("{}", st),
850
850
/// Outer::Single(opt) => println!("{:?}", opt),
851
851
/// _ => the_rest(),
852
852
/// }
853
853
/// ```
854
- ///
854
+ ///
855
855
/// For more information on `match` and matching in general, see the [Reference].
856
- ///
856
+ ///
857
857
/// [Reference]: ../reference/expressions/match-expr.html
858
858
mod match_keyword { }
859
859
@@ -874,29 +874,29 @@ mod mod_keyword { }
874
874
/// `move` converts any variables captured by reference or mutable reference
875
875
/// to owned by value variables. The three [`Fn` trait]'s mirror the ways to capture
876
876
/// variables, when `move` is used the closures is represented by the `FnOnce` trait.
877
- ///
877
+ ///
878
878
/// ```rust
879
879
/// let capture = "hello";
880
880
/// let closure = move || {
881
881
/// println!("we say {}", capture);
882
882
/// };
883
883
/// ```
884
- ///
884
+ ///
885
885
/// `move` is often used when [threads] are involved.
886
- ///
886
+ ///
887
887
/// ```rust
888
888
/// let x = 5;
889
- ///
889
+ ///
890
890
/// std::thread::spawn(move || {
891
891
/// println!("captured {} by value", x)
892
892
/// }).join().unwrap();
893
- ///
893
+ ///
894
894
/// // x is no longer available
895
895
/// ```
896
- ///
896
+ ///
897
897
/// For more information on the `move` keyword, see the [closure]'s section
898
898
/// of the Rust book or the [threads] section
899
- ///
899
+ ///
900
900
/// [`Fn` trait]: ../std/ops/trait.Fn.html
901
901
/// [closure]: ../book/ch13-01-closures.html
902
902
/// [threads]: ../book/ch16-01-threads.html#using-move-closures-with-threads
0 commit comments