New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement chapter3_9 other than problem 3_9_6 #33
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます!😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
全体的にほぼ良かったのですが、細かい点だけコメントしました 🙏
Co-authored-by: Sho Nakatani <lay.sakura@gmail.com>
Co-authored-by: Sho Nakatani <lay.sakura@gmail.com>
レビューありがとうございます 🙇 |
@k-nasa 対応ありがとうございます。私のsuggestionを取り入れていただきましたが、空で書いたためそのままではビルドが通らずCIが落ちています... |
…rogramming-in-rust into replace_3_9_section
🙈 すみません。完全に脳死していました。 |
|
||
fn main() -> io::Result<()> { | ||
let mut bytes = [0u8; 1024]; | ||
rand::thread_rng().fill(&mut bytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docを見るにgen
では最大で32要素しか埋められないらしく、fill
を使うことにしました。
ref: https://docs.rs/rand/0.8.3/rand/trait.Rng.html#arrays-and-tuples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
そうなんですね 😮 勉強になりました 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
マージします |
ref: #16
3.9節の1~5までの実装を行いました。
3.9.6に関しては、golangだとio.multiReader, io.SectionReaderを使って得問題のようで、Rust標準には代替のものがボクの知る限りありません。multiReader, SectionReaderを実装するのは骨が折れますし問題の趣旨からずれそうなので一旦スキップしました。
Proof
以下動作確認ログになります。
3.9.1
3.9.2
3.9.3
3.9.4
localhost:8080にアクセスすると次のファイルがダウンロードできる
3.9.5