Skip to content

Commit 7dce9e1

Browse files
committed
ch05 構造体を使用して関係のあるデータを構造化するの和訳を最新版に更新
rust-lang/book@19c40bf
1 parent 005ab57 commit 7dce9e1

File tree

66 files changed

+973
-774
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+973
-774
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "structs"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch05-using-structs-to-structure-related-data/listing-05-01/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// ANCHOR: here
22
struct User {
3+
active: bool,
34
username: String,
45
email: String,
56
sign_in_count: u64,
6-
active: bool,
77
}
88
// ANCHOR_END: here
99

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "structs"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
struct User {
2+
active: bool,
23
username: String,
34
email: String,
45
sign_in_count: u64,
5-
active: bool,
66
}
77

8+
// ANCHOR: here
89
fn main() {
9-
// ANCHOR: here
1010
let user1 = User {
11-
email: String::from("[email protected]"),
12-
username: String::from("someusername123"),
1311
active: true,
12+
username: String::from("someusername123"),
13+
email: String::from("[email protected]"),
1414
sign_in_count: 1,
1515
};
16-
// ANCHOR_END: here
1716
}
17+
// ANCHOR_END: here
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "structs"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
struct User {
2+
active: bool,
23
username: String,
34
email: String,
45
sign_in_count: u64,
5-
active: bool,
66
}
77

8+
// ANCHOR: here
89
fn main() {
9-
// ANCHOR: here
1010
let mut user1 = User {
11-
email: String::from("[email protected]"),
12-
username: String::from("someusername123"),
1311
active: true,
12+
username: String::from("someusername123"),
13+
email: String::from("[email protected]"),
1414
sign_in_count: 1,
1515
};
1616

1717
user1.email = String::from("[email protected]");
18-
// ANCHOR_END: here
1918
}
19+
// ANCHOR_END: here
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "structs"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch05-using-structs-to-structure-related-data/listing-05-04/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
struct User {
2+
active: bool,
23
username: String,
34
email: String,
45
sign_in_count: u64,
5-
active: bool,
66
}
77

88
// ANCHOR: here
99
fn build_user(email: String, username: String) -> User {
1010
User {
11-
email: email,
12-
username: username,
1311
active: true,
12+
username: username,
13+
email: email,
1414
sign_in_count: 1,
1515
}
1616
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "structs"
33
version = "0.1.0"
4-
authors = ["Your Name <[email protected]>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch05-using-structs-to-structure-related-data/listing-05-05/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
struct User {
2+
active: bool,
23
username: String,
34
email: String,
45
sign_in_count: u64,
5-
active: bool,
66
}
77

88
// ANCHOR: here
99
fn build_user(email: String, username: String) -> User {
1010
User {
11-
email,
12-
username,
1311
active: true,
12+
username,
13+
email,
1414
sign_in_count: 1,
1515
}
1616
}

0 commit comments

Comments
 (0)