@@ -32,7 +32,7 @@ two languages for those phrases to be in. We'll use this module layout:
32
32
+---------+ | +-----------+
33
33
| +---| farewells |
34
34
+---------+ | +-----------+
35
- | phrases |---+
35
+ | phrases |---+
36
36
+---------+ | +-----------+
37
37
| +---| greetings |
38
38
+----------+ | +-----------+
@@ -219,7 +219,7 @@ Put this in `src/english/greetings.rs`:
219
219
220
220
fn hello () -> String {
221
221
" Hello!" . to_string ()
222
- }
222
+ }
223
223
```
224
224
225
225
Put this in ` src/english/farewells.rs ` :
@@ -229,7 +229,7 @@ Put this in `src/english/farewells.rs`:
229
229
230
230
fn goodbye () -> String {
231
231
" Goodbye." . to_string ()
232
- }
232
+ }
233
233
```
234
234
235
235
Put this in ` src/japanese/greetings.rs ` :
@@ -239,7 +239,7 @@ Put this in `src/japanese/greetings.rs`:
239
239
240
240
fn hello () -> String {
241
241
" こんにちは" . to_string ()
242
- }
242
+ }
243
243
```
244
244
245
245
Of course, you can copy and paste this from this web page, or just type
@@ -253,7 +253,7 @@ Put this in `src/japanese/farewells.rs`:
253
253
254
254
fn goodbye () -> String {
255
255
" さようなら" . to_string ()
256
- }
256
+ }
257
257
```
258
258
259
259
(This is "Sayoonara", if you're curious.)
@@ -381,11 +381,11 @@ $ cargo run
381
381
/home/you/projects/phrases/src/japanese/greetings.rs:1:1: 3:2 warning: code is never used: ` hello` , # [warn(dead_code)] on by default
382
382
/home/you/projects/phrases/src/japanese/greetings.rs:1 fn hello () -> String {
383
383
/home/you/projects/phrases/src/japanese/greetings.rs:2 " こんにちは" .to_string()
384
- /home/you/projects/phrases/src/japanese/greetings.rs:3 }
384
+ /home/you/projects/phrases/src/japanese/greetings.rs:3 }
385
385
/home/you/projects/phrases/src/japanese/farewells.rs:1:1: 3:2 warning: code is never used: ` goodbye` , # [warn(dead_code)] on by default
386
386
/home/you/projects/phrases/src/japanese/farewells.rs:1 fn goodbye () -> String {
387
387
/home/you/projects/phrases/src/japanese/farewells.rs:2 " さようなら" .to_string()
388
- /home/you/projects/phrases/src/japanese/farewells.rs:3 }
388
+ /home/you/projects/phrases/src/japanese/farewells.rs:3 }
389
389
Running ` target/phrases`
390
390
Hello in English: Hello!
391
391
Goodbye in English: Goodbye.
@@ -452,7 +452,7 @@ fn main() {
452
452
453
453
Rust will give us a compile-time error:
454
454
455
- ` ` ` {ignore }
455
+ ` ` ` {notrust }
456
456
Compiling phrases v0.0.1 (file:///home/you/projects/phrases)
457
457
/home/you/projects/phrases/src/main.rs:4:5: 4:40 error: a value named ` hello` has already been imported in this module
458
458
/home/you/projects/phrases/src/main.rs:4 use phrases::japanese::greetings::hello;
0 commit comments