File tree Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Expand file tree Collapse file tree 4 files changed +20
-6
lines changed Original file line number Diff line number Diff line change 14
14
15
15
### 各コードの実行方法
16
16
17
- ` cargo workspace ` 等の機能を使用しているので、実行には ` cargo run ` 以外にさらにいくつかオプションをつける必要があります。たとえば ` chapter2 ` の ` main_2_4_1 .rs` を実行したい場合には、下記のように ` cargo ` コマンドを打つと実行できます。
17
+ ` cargo workspace ` 等の機能を使用しているので、実行には ` cargo run ` 以外にさらにいくつかオプションをつける必要があります。たとえば ` chapter2 ` の ` 2_4_1/main .rs` を実行したい場合には、下記のように ` cargo ` コマンドを打つと実行できます。
18
18
19
19
``` bash
20
- cargo run -p chapter2 --bin main_2_4_1
20
+ cargo run -p chapter2 --bin 2_4_1
21
21
```
22
22
23
23
### Rust バージョン
Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ edition = "2018"
9
9
[dependencies ]
10
10
11
11
[[bin ]]
12
- name = " main_2_4_1 "
13
- path = " src/main_2_4_1 .rs"
12
+ name = " 2_4_1 "
13
+ path = " src/2_4_1/main .rs"
14
14
15
15
[[bin ]]
16
- name = " main_2_4_2 "
17
- path = " src/main_2_4_2 .rs"
16
+ name = " 2_4_2 "
17
+ path = " src/2_4_2/main .rs"
18
18
19
19
[[bin ]]
20
20
name = " client_2_4_4"
Original file line number Diff line number Diff line change
1
+ use std:: fs:: File ;
2
+ use std:: io:: Write ;
3
+
4
+ fn main ( ) -> std:: io:: Result < ( ) > {
5
+ let mut file = File :: create ( "test.txt" ) ?;
6
+ file. write ( b"std::fs::File example\n " ) ?;
7
+ Ok ( ( ) )
8
+ }
Original file line number Diff line number Diff line change
1
+ use std:: io:: { stdout, Write } ;
2
+
3
+ fn main ( ) -> std:: io:: Result < ( ) > {
4
+ stdout ( ) . write ( b"std::io::stdout example\n " ) ?;
5
+ Ok ( ( ) )
6
+ }
You can’t perform that action at this time.
0 commit comments