@@ -10006,7 +10006,7 @@ <h2 id="main内で使うresult"><a class="header" href="#main内で使うresult"
10006
10006
representation of the error (using the [`Debug`] trait). The following example
10007
10007
shows such a scenario and touches on aspects covered in [the following section].
10008
10008
-->
10009
- <p>一方<code>main</code>で<code>Result</code>をリターン型とすることも可能です。エラーが<code>main</code>関数内で発生した時、エラーコードを返し、エラーに関するデバッグ表記を(<a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html"><code>Debug</code></a>トレートを使って )出力します。以下の例ではそのようなシナリオを示し、<a href="error/result/early_returns.html">この先の節</a>でカバーする内容に触れていきます。</p>
10009
+ <p>一方<code>main</code>で<code>Result</code>をリターン型とすることも可能です。エラーが<code>main</code>関数内で発生した時、エラーコードを返し、エラーに関するデバッグ表記を(<a href="https://doc.rust-lang.org/std/fmt/trait.Debug.html"><code>Debug</code></a>トレイトを使って )出力します。以下の例ではそのようなシナリオを示し、<a href="error/result/early_returns.html">この先の節</a>でカバーする内容に触れていきます。</p>
10010
10010
<pre><pre class="playground"><code class="language-rust editable edition2021">use std::num::ParseIntError;
10011
10011
10012
10012
fn main() -> Result<(), ParseIntError> {
@@ -10037,7 +10037,7 @@ <h1 id="resultのmap"><a class="header" href="#resultのmap"><code>Result</code>
10037
10037
[`FromStr`][from_str] trait for [`i32`][i32]. As a result, the `Err` type is
10038
10038
specified as [`ParseIntError`][parse_int_error].
10039
10039
-->
10040
- <p>まずは、どのようなエラー型を扱っているのかを知る必要があります。<code>Err</code>型を定めるために、<a href="https://doc.rust-lang.org/std/primitive.i32.html"><code>i32</code></a>に対し<a href="https://doc.rust-lang.org/std/str/trait.FromStr.html"><code>FromStr</code></a>トレートを使って実装された <a href="https://doc.rust-lang.org/std/primitive.str.html#method.parse"><code>parse()</code></a>を見てみましょう。結果、<code>Err</code>型は<a href="https://doc.rust-lang.org/std/num/struct.ParseIntError.html"><code>ParseIntError</code></a>というものであることが分かります。</p>
10040
+ <p>まずは、どのようなエラー型を扱っているのかを知る必要があります。<code>Err</code>型を定めるために、<a href="https://doc.rust-lang.org/std/primitive.i32.html"><code>i32</code></a>に対し<a href="https://doc.rust-lang.org/std/str/trait.FromStr.html"><code>FromStr</code></a>トレイトを使って実装された <a href="https://doc.rust-lang.org/std/primitive.str.html#method.parse"><code>parse()</code></a>を見てみましょう。結果、<code>Err</code>型は<a href="https://doc.rust-lang.org/std/num/struct.ParseIntError.html"><code>ParseIntError</code></a>というものであることが分かります。</p>
10041
10041
<!--
10042
10042
In the example below, the straightforward `match` statement leads to code
10043
10043
that is overall more cumbersome.
@@ -10543,7 +10543,7 @@ <h1 id="エラーをboxする"><a class="header" href="#エラーをboxする">
10543
10543
any type that implements the `Error` trait into the trait object `Box<Error>`,
10544
10544
via [`From`][from].
10545
10545
-->
10546
- <p>標準ライブラリは<code>Box</code>に、<a href="https://doc.rust-lang.org/std/convert/trait.From.html"><code>From</code></a>を介してあらゆる<code>Error</code>トレートを実装した型から <code>Box<Error></code>トレートオブジェクトへの変換を実装させることで 、エラーをboxしやすくしてくれます。</p>
10546
+ <p>標準ライブラリは<code>Box</code>に、<a href="https://doc.rust-lang.org/std/convert/trait.From.html"><code>From</code></a>を介してあらゆる<code>Error</code>トレイトを実装した型から <code>Box<Error></code>トレイトオブジェクトへの変換を実装させることで 、エラーをboxしやすくしてくれます。</p>
10547
10547
<pre><pre class="playground"><code class="language-rust editable edition2021">use std::error;
10548
10548
use std::fmt;
10549
10549
@@ -10731,8 +10731,8 @@ <h1 id="エラーをラップする"><a class="header" href="#エラーをラッ
10731
10731
// cast to the trait object `&error::Error`. This works because the
10732
10732
// underlying type already implements the `Error` trait.
10733
10733
// 元の実装のエラー型が原因。
10734
- // `&error::Error`トレートオブジェクトに暗にキャストされる 。
10735
- // 元となる型が`Error`トレートをすでに実装しているため問題なく動く 。
10734
+ // `&error::Error`トレイトオブジェクトに暗にキャストされる 。
10735
+ // 元となる型が`Error`トレイトをすでに実装しているため問題なく動く 。
10736
10736
DoubleError::Parse(ref e) => Some(e),
10737
10737
}
10738
10738
}
0 commit comments