]> git.lizzy.rs Git - rust.git/blob - src/libstd/keyword_docs.rs
rustbuild: fix remap-debuginfo when building a release
[rust.git] / src / libstd / keyword_docs.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #[doc(keyword = "fn")]
12 //
13 /// The `fn` keyword.
14 ///
15 /// The `fn` keyword is used to declare a function.
16 ///
17 /// Example:
18 ///
19 /// ```rust
20 /// fn some_function() {
21 ///     // code goes in here
22 /// }
23 /// ```
24 ///
25 /// For more information about functions, take a look at the [Rust Book][book].
26 ///
27 /// [book]: https://doc.rust-lang.org/book/second-edition/ch03-03-how-functions-work.html
28 mod fn_keyword { }
29
30 #[doc(keyword = "let")]
31 //
32 /// The `let` keyword.
33 ///
34 /// The `let` keyword is used to declare a variable.
35 ///
36 /// Example:
37 ///
38 /// ```rust
39 /// # #![allow(unused_assignments)]
40 /// let x = 3; // We create a variable named `x` with the value `3`.
41 /// ```
42 ///
43 /// By default, all variables are **not** mutable. If you want a mutable variable,
44 /// you'll have to use the `mut` keyword.
45 ///
46 /// Example:
47 ///
48 /// ```rust
49 /// # #![allow(unused_assignments)]
50 /// let mut x = 3; // We create a mutable variable named `x` with the value `3`.
51 ///
52 /// x += 4; // `x` is now equal to `7`.
53 /// ```
54 ///
55 /// For more information about the `let` keyword, take a look at the [Rust Book][book].
56 ///
57 /// [book]: https://doc.rust-lang.org/book/second-edition/ch03-01-variables-and-mutability.html
58 mod let_keyword { }
59
60 #[doc(keyword = "struct")]
61 //
62 /// The `struct` keyword.
63 ///
64 /// The `struct` keyword is used to define a struct type.
65 ///
66 /// Example:
67 ///
68 /// ```
69 /// struct Foo {
70 ///     field1: u32,
71 ///     field2: String,
72 /// }
73 /// ```
74 ///
75 /// There are different kinds of structs. For more information, take a look at the
76 /// [Rust Book][book].
77 ///
78 /// [book]: https://doc.rust-lang.org/book/second-edition/ch05-01-defining-structs.html
79 mod struct_keyword { }