Skip to content

Commit 20bed51

Browse files
committed
ch07 肥大化していくプロジェクトをパッケージ、クレート、モジュールを利用して管理するの和訳を最新版に更新
rust-lang/book@19c40bf
1 parent 0de9bcf commit 20bed51

File tree

48 files changed

+950
-577
lines changed

Some content is hidden

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

48 files changed

+950
-577
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "restaurant"
33
version = "0.1.0"
4-
authors = ["Your Name <you@example.com>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch07-managing-growing-projects/listing-07-01/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ANCHOR: here
21
mod front_of_house {
32
mod hosting {
43
fn add_to_waitlist() {}
@@ -14,6 +13,3 @@ mod front_of_house {
1413
fn take_payment() {}
1514
}
1615
}
17-
// ANCHOR_END: here
18-
19-
fn main() {}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "restaurant"
33
version = "0.1.0"
4-
authors = ["Your Name <you@example.com>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch07-managing-growing-projects/listing-07-03/output.txt

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,29 @@ error[E0603]: module `hosting` is private
44
--> src/lib.rs:9:28
55
|
66
9 | crate::front_of_house::hosting::add_to_waitlist();
7-
| ^^^^^^^
7+
| ^^^^^^^ --------------- function `add_to_waitlist` is not publicly re-exported
8+
| |
9+
| private module
10+
|
11+
note: the module `hosting` is defined here
12+
--> src/lib.rs:2:5
13+
|
14+
2 | mod hosting {
15+
| ^^^^^^^^^^^
816

917
error[E0603]: module `hosting` is private
1018
--> src/lib.rs:12:21
1119
|
1220
12 | front_of_house::hosting::add_to_waitlist();
13-
| ^^^^^^^
14-
15-
error: aborting due to 2 previous errors
21+
| ^^^^^^^ --------------- function `add_to_waitlist` is not publicly re-exported
22+
| |
23+
| private module
24+
|
25+
note: the module `hosting` is defined here
26+
--> src/lib.rs:2:5
27+
|
28+
2 | mod hosting {
29+
| ^^^^^^^^^^^
1630

1731
For more information about this error, try `rustc --explain E0603`.
18-
error: could not compile `restaurant`.
19-
20-
To learn more, run the command again with --verbose.
32+
error: could not compile `restaurant` (lib) due to 2 previous errors
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "restaurant"
33
version = "0.1.0"
4-
authors = ["Your Name <you@example.com>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch07-managing-growing-projects/listing-07-05/output.txt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,25 @@ error[E0603]: function `add_to_waitlist` is private
44
--> src/lib.rs:9:37
55
|
66
9 | crate::front_of_house::hosting::add_to_waitlist();
7-
| ^^^^^^^^^^^^^^^
7+
| ^^^^^^^^^^^^^^^ private function
8+
|
9+
note: the function `add_to_waitlist` is defined here
10+
--> src/lib.rs:3:9
11+
|
12+
3 | fn add_to_waitlist() {}
13+
| ^^^^^^^^^^^^^^^^^^^^
814

915
error[E0603]: function `add_to_waitlist` is private
1016
--> src/lib.rs:12:30
1117
|
1218
12 | front_of_house::hosting::add_to_waitlist();
13-
| ^^^^^^^^^^^^^^^
14-
15-
error: aborting due to 2 previous errors
19+
| ^^^^^^^^^^^^^^^ private function
20+
|
21+
note: the function `add_to_waitlist` is defined here
22+
--> src/lib.rs:3:9
23+
|
24+
3 | fn add_to_waitlist() {}
25+
| ^^^^^^^^^^^^^^^^^^^^
1626

1727
For more information about this error, try `rustc --explain E0603`.
18-
error: could not compile `restaurant`.
19-
20-
To learn more, run the command again with --verbose.
28+
error: could not compile `restaurant` (lib) due to 2 previous errors
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "restaurant"
33
version = "0.1.0"
4-
authors = ["Your Name <you@example.com>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]

listings/ch07-managing-growing-projects/listing-07-07/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ANCHOR: here
21
mod front_of_house {
32
pub mod hosting {
43
pub fn add_to_waitlist() {}
@@ -14,6 +13,3 @@ pub fn eat_at_restaurant() {
1413
// 相対パス
1514
front_of_house::hosting::add_to_waitlist();
1615
}
17-
// ANCHOR_END: here
18-
19-
fn main() {}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[package]
22
name = "restaurant"
33
version = "0.1.0"
4-
authors = ["Your Name <you@example.com>"]
5-
edition = "2018"
4+
edition = "2021"
65

76
[dependencies]
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
// ANCHOR: here
2-
fn serve_order() {}
1+
fn deliver_order() {}
32

43
mod back_of_house {
54
fn fix_incorrect_order() {
65
cook_order();
7-
super::serve_order();
6+
super::deliver_order();
87
}
98

109
fn cook_order() {}
1110
}
12-
// ANCHOR_END: here
13-
14-
fn main() {}

0 commit comments

Comments
 (0)