File tree 23 files changed +124
-3
lines changed
23 files changed +124
-3
lines changed Original file line number Diff line number Diff line change @@ -17,5 +17,6 @@ members = [
17
17
" chapter15" ,
18
18
" chapter16" ,
19
19
" chapter17" ,
20
- " appendix"
20
+ " appendix" ,
21
+ " lib"
21
22
]
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change 1
1
[package ]
2
- name = " chapter2"
3
- version = " 0.1.0"
4
2
authors = [
" yytyd <[email protected] >" ]
5
3
edition = " 2018"
4
+ name = " chapter2"
5
+ version = " 0.1.0"
6
6
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
10
11
11
12
[[bin ]]
12
13
name = " 2_4_1"
@@ -16,10 +17,18 @@ path = "src/2_4_1/main.rs"
16
17
name = " 2_4_2"
17
18
path = " src/2_4_2/main.rs"
18
19
20
+ [[bin ]]
21
+ name = " 2_4_3"
22
+ path = " src/2_4_3/main.rs"
23
+
19
24
[[bin ]]
20
25
name = " client_2_4_4"
21
26
path = " src/2_4_4/client.rs"
22
27
23
28
[[bin ]]
24
29
name = " server_2_4_4"
25
30
path = " src/2_4_4/server.rs"
31
+
32
+ [[bin ]]
33
+ name = " 2_8_2"
34
+ path = " src/2_8_2/main.rs"
Original file line number Diff line number Diff line change
1
+ use std:: io:: Write ;
2
+ use std:: str;
3
+
4
+ #[ derive( Debug ) ]
5
+ enum BufferError {
6
+ IOError ( std:: io:: Error ) ,
7
+ StrError ( str:: Utf8Error ) ,
8
+ }
9
+
10
+ impl From < std:: io:: Error > for BufferError {
11
+ fn from ( error : std:: io:: Error ) -> Self {
12
+ BufferError :: IOError ( error)
13
+ }
14
+ }
15
+
16
+ impl From < str:: Utf8Error > for BufferError {
17
+ fn from ( error : str:: Utf8Error ) -> Self {
18
+ BufferError :: StrError ( error)
19
+ }
20
+ }
21
+
22
+ fn main ( ) -> Result < ( ) , BufferError > {
23
+ let mut buffer: Vec < u8 > = Vec :: new ( ) ;
24
+ buffer. write ( b"bytes.Buffer example1\n " ) ?;
25
+ println ! ( "{}" , str :: from_utf8( & buffer) ?) ;
26
+ buffer. write ( b"bytes.Buffer example2\n " ) ?;
27
+ println ! ( "{}" , str :: from_utf8( & buffer) ?) ;
28
+ Ok ( ( ) )
29
+ }
Original file line number Diff line number Diff line change
1
+ fn main ( ) {
2
+ unimplemented ! ( "『Goならわかるシステムプログラミング』の該当問題は `encoding/csv` パッケージを使うことが主題なので、Rustへの移植はできない。" ) ;
3
+ }
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ edition = "2018"
9
9
[dependencies ]
10
10
rand = " 0.8.3"
11
11
zip = " 0.5.12"
12
+ lib = { path = " ../lib" }
12
13
13
14
[[bin ]]
14
15
name = " main_3_1"
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ edition = "2018"
7
7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
8
9
9
[dependencies ]
10
+ lib = { path = " ../lib" }
Original file line number Diff line number Diff line change
1
+ [package ]
2
+ name = " lib"
3
+ version = " 0.1.0"
4
+ authors = [
" yuk1ty <[email protected] >" ]
5
+ edition = " 2018"
6
+
7
+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
+
9
+ [dependencies ]
Original file line number Diff line number Diff line change
1
+ // 共通ライブラリ
You can’t perform that action at this time.
0 commit comments