summaryrefslogtreecommitdiffstats
path: root/src/doc/book/listings/ch05-using-structs-to-structure-related-data/listing-05-03/src/main.rs
blob: 35eea8a9a1ff16a6b1cda7f626298d02cac27528 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
struct User {
    active: bool,
    username: String,
    email: String,
    sign_in_count: u64,
}

// ANCHOR: here
fn main() {
    let mut user1 = User {
        active: true,
        username: String::from("someusername123"),
        email: String::from("someone@example.com"),
        sign_in_count: 1,
    };

    user1.email = String::from("anotheremail@example.com");
}
// ANCHOR_END: here