yuk1ty / learning-systems-programming-in-rust

「Rustでもわかるシステムプログラミング」
430 stars 23 forks source link

implement chapter3_9 other than problem 3_9_6 #33

Closed k-nasa closed 3 years ago

k-nasa commented 3 years ago

ref: https://github.com/yuk1ty/learning-systems-programming-in-rust/issues/16

3.9節の1~5までの実装を行いました。

3.9.6に関しては、golangだとio.multiReader, io.SectionReaderを使って得問題のようで、Rust標準には代替のものがボクの知る限りありません。multiReader, SectionReaderを実装するのは骨が折れますし問題の趣旨からずれそうなので一旦スキップしました。

Proof

以下動作確認ログになります。

### 3.9.1 ``` ❯ cargo run -p chapter3 --bin 3_9_1 chapter3/src/3_9_1/old.txt new.txt Finished dev [unoptimized + debuginfo] target(s) in 0.03s Running `target/debug/3_9_1 chapter3/src/3_9_1/old.txt new.txt` ❯ cat new.txt old text ``` ### 3.9.2 ``` ❯ cargo run -p chapter3 --bin 3_9_2 Finished dev [unoptimized + debuginfo] target(s) in 0.02s Running `target/debug/3_9_2` ❯ wc -c random.txt 1024 random.txt ``` ### 3.9.3 ``` ❯ cargo run -p chapter3 --bin 3_9_3 Finished dev [unoptimized + debuginfo] target(s) in 0.02s Running `target/debug/3_9_3` ❯ unzip file.zip Archive: file.zip inflating: file.txt ❯ cat file.txt zipzipzipzipzipzipzipzipzipzipzipzipzipzipzipzip ``` ### 3.9.4 ``` ❯ cargo run -p chapter3 --bin 3_9_4 ``` localhost:8080にアクセスすると次のファイルがダウンロードできる スクリーンショット 2021-05-01 17 53 58 ### 3.9.5 ``` ❯ echo "testtest" > test.txt ❯ cargo run -p chapter3 --bin 3_9_5 Finished dev [unoptimized + debuginfo] target(s) in 0.03s Running `target/debug/3_9_5` ❯ cat new_test.txt test ```
k-nasa commented 3 years ago

レビューありがとうございます 🙇
指摘いただいた箇所の修正は終わりました!

laysakura commented 3 years ago

@k-nasa 対応ありがとうございます。私のsuggestionを取り入れていただきましたが、空で書いたためそのままではビルドが通らずCIが落ちています... 動作確認 & commit & pushをお願いします。

k-nasa commented 3 years ago

🙈 すみません。完全に脳死していました。 buildが通ることを確認しました。

yuk1ty commented 3 years ago

マージします