book-ja
book-ja copied to clipboard
"dyn"を付与する必要あり
以下に"dyn"を付与するがあります。(本家は対応済みのようです。) https://github.com/rust-lang-ja/book-ja/blob/master-ja/src/ch12-03-improving-error-handling-and-modularity.md?plain=1#L913
旧
fn run(config: Config) -> Result<(), Box<Error>> {
let mut f = File::open(config.filename)?;
let mut contents = String::new();
f.read_to_string(&mut contents)?;
println!("With text:\n{}", contents);
Ok(())
}
↓
新
fn run(config: Config) -> Result<(), Box<dyn Error>> {
let mut f = File::open(config.filename)?;
let mut contents = String::new();
f.read_to_string(&mut contents)?;
println!("With text:\n{}", contents);
Ok(())
}
ご報告ありがとうございます。ざっと確認したところ、以下の章のコードにdynを追加する必要があるようです。
- [ ] ch09
- [ ] ch12
- [ ] ch13
- [ ] ch17
- [ ] ch19
- [ ] ch20
順番に対応していく予定です。
ch12 を変更しました!よろしければ取り入れてください! https://github.com/rust-lang-ja/book-ja/pull/214
対応いただいたのでcloseします