File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 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
99
1010``` rust,editable
1111#[derive(Debug)]
12- struct Person<'a> {
13- // The 'a defines a lifetime
14- name: &'a str,
12+ struct Person {
13+ name: String,
1514 age: u8,
1615}
1716
@@ -38,7 +37,7 @@ struct Rectangle {
3837
3938fn main() {
4039 // Create struct with field init shorthand
41- let name = "Peter";
40+ let name = String::from( "Peter") ;
4241 let age = 27;
4342 let peter = Person { name, age };
4443
@@ -93,9 +92,8 @@ fn main() {
9392
9493### See also:
9594
96- [ ` attributes ` ] [ attributes ] , [ lifetime ] [ lifetime ] and [ destructuring] [ destructuring ]
95+ [ ` attributes ` ] [ attributes ] , and [ destructuring] [ destructuring ]
9796
9897[ attributes ] : ../attribute.md
9998[ c_struct ] : https://en.wikipedia.org/wiki/Struct_(C_programming_language)
10099[ destructuring ] : ../flow_control/match/destructuring.md
101- [ lifetime ] : ../scope/lifetime.md
You can’t perform that action at this time.
0 commit comments