1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
struct User {
username: String,
email: String,
sign_in_count: u64,
active: bool,
}
fn main() {
// let mut user1 = User {
// email: String::from("test@tester.net"),
// username: String::from("testytester"),
// active: true,
// sign_in_count: 999,
// };
// let user1 = build_user(String::from("dennis.nedry@adp.com"), String::from("nedryland"));
// let user2 = User {
// email: String::from("john.hammond@adp.com"),
// username: String::from("spare_no_expense"),
// ..user1
// };
// println!("{} {} {} {}", user2.email, user2.username, user2.active, user2.sign_in_count);
struct Color(u32, u32, u32);
struct Point(i32, i32, i32);
let black = Color(0, 0, 0);
let origin = Point(0, -1, 0);
}
fn build_user(email: String, username: String) -> User {
User {
email,
username,
active: true,
sign_in_count: 1,
}
}
|