Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/custom_types/structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ There are three types of structures ("structs") that can be created using the

```rust,editable
#[derive(Debug)]
struct Person<'a> {
// The 'a defines a lifetime
name: &'a str,
struct Person {
name: String,
age: u8,
}

Expand All @@ -38,7 +37,7 @@ struct Rectangle {

fn main() {
// Create struct with field init shorthand
let name = "Peter";
let name = String::from("Peter");
let age = 27;
let peter = Person { name, age };

Expand Down Expand Up @@ -93,9 +92,8 @@ fn main() {

### See also:

[`attributes`][attributes], [lifetime][lifetime] and [destructuring][destructuring]
[`attributes`][attributes], and [destructuring][destructuring]

[attributes]: ../attribute.md
[c_struct]: https://en.wikipedia.org/wiki/Struct_(C_programming_language)
[destructuring]: ../flow_control/match/destructuring.md
[lifetime]: ../scope/lifetime.md