File tree 1 file changed +4
-6
lines changed
1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,8 @@ There are three types of structures ("structs") that can be created using the
9
9
10
10
``` rust,editable
11
11
#[derive(Debug)]
12
- struct Person<'a> {
13
- // The 'a defines a lifetime
14
- name: &'a str,
12
+ struct Person {
13
+ name: String,
15
14
age: u8,
16
15
}
17
16
@@ -38,7 +37,7 @@ struct Rectangle {
38
37
39
38
fn main() {
40
39
// Create struct with field init shorthand
41
- let name = "Peter";
40
+ let name = String::from( "Peter") ;
42
41
let age = 27;
43
42
let peter = Person { name, age };
44
43
@@ -93,9 +92,8 @@ fn main() {
93
92
94
93
### See also:
95
94
96
- [ ` attributes ` ] [ attributes ] , [ lifetime ] [ lifetime ] and [ destructuring] [ destructuring ]
95
+ [ ` attributes ` ] [ attributes ] , and [ destructuring] [ destructuring ]
97
96
98
97
[ attributes ] : ../attribute.md
99
98
[ c_struct ] : https://en.wikipedia.org/wiki/Struct_(C_programming_language)
100
99
[ destructuring ] : ../flow_control/match/destructuring.md
101
- [ lifetime ] : ../scope/lifetime.md
You can’t perform that action at this time.
0 commit comments