Skip to content

Commit 9919840

Browse files
committed
ci: generate pages at 0a76468 [ci skip]
1 parent 0a76468 commit 9919840

File tree

5 files changed

+70
-28
lines changed

5 files changed

+70
-28
lines changed

docs/print.html

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7359,12 +7359,19 @@ <h1 id="部分的ムーブ"><a class="header" href="#部分的ムーブ">部分
73597359
// `person` は使用できないが、 `person.age` はムーブしていないので使用できる
73607360
println!(&quot;The person's age from person struct is {}&quot;, person.age);
73617361
}</code></pre></pre>
7362-
<p>(In this example, we store the <code>age</code> variable on the heap to
7363-
illustrate the partial move: deleting <code>ref</code> in the above code would
7364-
give an error as the ownership of <code>person.age</code> would be moved to the
7365-
variable <code>age</code>. If <code>Person.age</code> were stored on the stack, <code>ref</code> would
7366-
not be required as the definition of <code>age</code> would copy the data from
7367-
<code>person.age</code> without moving it.)</p>
7362+
<!--
7363+
(In this example, we store the `age` variable on the heap to
7364+
illustrate the partial move: deleting `ref` in the above code would
7365+
give an error as the ownership of `person.age` would be moved to the
7366+
variable `age`. If `Person.age` were stored on the stack, `ref` would
7367+
not be required as the definition of `age` would copy the data from
7368+
`person.age` without moving it.)
7369+
-->
7370+
<p>この例では、<code>age</code>変数をヒープ上に保持し、部分的ムーブを説明しています。
7371+
上記コードで<code>ref</code>を削除すると、<code>person.age</code>の所有権が<code>age</code>変数にムーブされるため、エラーになります。
7372+
もしも<code>Person.age</code>がスタック上に保持されていたら、
7373+
<code>age</code>の定義が<code>person.age</code>をムーブすることなくデータをコピーするので、
7374+
<code>ref</code>は必須ではないのですが、実際にはヒープ上に保持されているため<code>ref</code>は必須です。</p>
73687375
<!--
73697376
### See also:
73707377
-->
@@ -11595,11 +11602,18 @@ <h2 id="literals-and-escapes"><a class="header" href="#literals-and-escapes">Lit
1159511602
println!(&quot;{}&quot;, op(1.0, 10.0));
1159611603
}</code></pre></pre>
1159711604
<div style="break-before: page; page-break-before: always;"></div><h1 id=""><a class="header" href="#"><code>?</code></a></h1>
11598-
<p>Chaining results using match can get pretty untidy; luckily, the <code>?</code> operator
11599-
can be used to make things pretty again. <code>?</code> is used at the end of an expression
11600-
returning a <code>Result</code>, and is equivalent to a match expression, where the
11601-
<code>Err(err)</code> branch expands to an early <code>return Err(From::from(err))</code>, and the <code>Ok(ok)</code>
11602-
branch expands to an <code>ok</code> expression.</p>
11605+
<!--
11606+
Chaining results using match can get pretty untidy; luckily, the `?` operator
11607+
can be used to make things pretty again. `?` is used at the end of an expression
11608+
returning a `Result`, and is equivalent to a match expression, where the
11609+
`Err(err)` branch expands to an early `return Err(From::from(err))`, and the `Ok(ok)`
11610+
branch expands to an `ok` expression.
11611+
-->
11612+
<p>マッチを利用して結果をチェインするのは中々面倒です。
11613+
幸いなことに、<code>?</code>マクロを使用すればイケてるコードに戻すことができます。
11614+
<code>?</code>は<code>Result</code>を返す式の末尾で使います。
11615+
<code>Err(err)</code>の分岐が<code>return Err(From::from(err))</code>という早期リターンに展開され、
11616+
<code>Ok(ok)</code>の分岐が<code>ok</code>の式に展開されるようなマッチ式と等価です。</p>
1160311617
<pre><pre class="playground"><code class="language-rust editable ignore mdbook-runnable edition2021">mod checked {
1160411618
#[derive(Debug)]
1160511619
enum MathError {
@@ -11635,11 +11649,14 @@ <h2 id="literals-and-escapes"><a class="header" href="#literals-and-escapes">Lit
1163511649
}
1163611650

1163711651
// Intermediate function
11652+
// 中間関数
1163811653
fn op_(x: f64, y: f64) -&gt; MathResult {
1163911654
// if `div` &quot;fails&quot;, then `DivisionByZero` will be `return`ed
11655+
// `div`が&quot;失敗&quot;したら、`DivisionByZero`が`return`される。
1164011656
let ratio = div(x, y)?;
1164111657

1164211658
// if `ln` &quot;fails&quot;, then `NonPositiveLogarithm` will be `return`ed
11659+
// もし`ln`が&quot;失敗&quot;したら、`NonPositiveLogarithm`が`return`される。
1164311660
let ln = ln(ratio)?;
1164411661

1164511662
sqrt(ln)
@@ -11663,8 +11680,12 @@ <h2 id="literals-and-escapes"><a class="header" href="#literals-and-escapes">Lit
1166311680
fn main() {
1166411681
checked::op(1.0, 10.0);
1166511682
}</code></pre></pre>
11666-
<p>Be sure to check the <a href="https://doc.rust-lang.org/std/result/index.html">documentation</a>,
11667-
as there are many methods to map/compose <code>Result</code>.</p>
11683+
<!--
11684+
Be sure to check the [documentation][docs],
11685+
as there are many methods to map/compose `Result`.
11686+
-->
11687+
<p><a href="https://doc.rust-lang.org/std/result/index.html">公式ドキュメント</a>をチェックすることをオススメします。
11688+
<code>Result</code>型を扱う関数や<code>Result</code>型のメソッドが多く挙げられています。</p>
1166811689
<div style="break-before: page; page-break-before: always;"></div><h1 id="panic-1"><a class="header" href="#panic-1"><code>panic!</code></a></h1>
1166911690
<!--
1167011691
The `panic!` macro can be used to generate a panic and start unwinding

docs/scope/move/partial_move.html

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,19 @@ <h1 id="部分的ムーブ"><a class="header" href="#部分的ムーブ">部分
187187
// `person` は使用できないが、 `person.age` はムーブしていないので使用できる
188188
println!(&quot;The person's age from person struct is {}&quot;, person.age);
189189
}</code></pre></pre>
190-
<p>(In this example, we store the <code>age</code> variable on the heap to
191-
illustrate the partial move: deleting <code>ref</code> in the above code would
192-
give an error as the ownership of <code>person.age</code> would be moved to the
193-
variable <code>age</code>. If <code>Person.age</code> were stored on the stack, <code>ref</code> would
194-
not be required as the definition of <code>age</code> would copy the data from
195-
<code>person.age</code> without moving it.)</p>
190+
<!--
191+
(In this example, we store the `age` variable on the heap to
192+
illustrate the partial move: deleting `ref` in the above code would
193+
give an error as the ownership of `person.age` would be moved to the
194+
variable `age`. If `Person.age` were stored on the stack, `ref` would
195+
not be required as the definition of `age` would copy the data from
196+
`person.age` without moving it.)
197+
-->
198+
<p>この例では、<code>age</code>変数をヒープ上に保持し、部分的ムーブを説明しています。
199+
上記コードで<code>ref</code>を削除すると、<code>person.age</code>の所有権が<code>age</code>変数にムーブされるため、エラーになります。
200+
もしも<code>Person.age</code>がスタック上に保持されていたら、
201+
<code>age</code>の定義が<code>person.age</code>をムーブすることなくデータをコピーするので、
202+
<code>ref</code>は必須ではないのですが、実際にはヒープ上に保持されているため<code>ref</code>は必須です。</p>
196203
<!--
197204
### See also:
198205
-->

docs/searchindex.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/searchindex.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/std/result/question_mark.html

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,18 @@ <h1 class="menu-title">Rust By Example 日本語版</h1>
146146
<div id="content" class="content">
147147
<main>
148148
<h1 id=""><a class="header" href="#"><code>?</code></a></h1>
149-
<p>Chaining results using match can get pretty untidy; luckily, the <code>?</code> operator
150-
can be used to make things pretty again. <code>?</code> is used at the end of an expression
151-
returning a <code>Result</code>, and is equivalent to a match expression, where the
152-
<code>Err(err)</code> branch expands to an early <code>return Err(From::from(err))</code>, and the <code>Ok(ok)</code>
153-
branch expands to an <code>ok</code> expression.</p>
149+
<!--
150+
Chaining results using match can get pretty untidy; luckily, the `?` operator
151+
can be used to make things pretty again. `?` is used at the end of an expression
152+
returning a `Result`, and is equivalent to a match expression, where the
153+
`Err(err)` branch expands to an early `return Err(From::from(err))`, and the `Ok(ok)`
154+
branch expands to an `ok` expression.
155+
-->
156+
<p>マッチを利用して結果をチェインするのは中々面倒です。
157+
幸いなことに、<code>?</code>マクロを使用すればイケてるコードに戻すことができます。
158+
<code>?</code><code>Result</code>を返す式の末尾で使います。
159+
<code>Err(err)</code>の分岐が<code>return Err(From::from(err))</code>という早期リターンに展開され、
160+
<code>Ok(ok)</code>の分岐が<code>ok</code>の式に展開されるようなマッチ式と等価です。</p>
154161
<pre><pre class="playground"><code class="language-rust editable ignore mdbook-runnable edition2021">mod checked {
155162
#[derive(Debug)]
156163
enum MathError {
@@ -186,11 +193,14 @@ <h1 id=""><a class="header" href="#"><code>?</code></a></h1>
186193
}
187194

188195
// Intermediate function
196+
// 中間関数
189197
fn op_(x: f64, y: f64) -&gt; MathResult {
190198
// if `div` &quot;fails&quot;, then `DivisionByZero` will be `return`ed
199+
// `div`が&quot;失敗&quot;したら、`DivisionByZero`が`return`される。
191200
let ratio = div(x, y)?;
192201

193202
// if `ln` &quot;fails&quot;, then `NonPositiveLogarithm` will be `return`ed
203+
// もし`ln`が&quot;失敗&quot;したら、`NonPositiveLogarithm`が`return`される。
194204
let ln = ln(ratio)?;
195205

196206
sqrt(ln)
@@ -214,8 +224,12 @@ <h1 id=""><a class="header" href="#"><code>?</code></a></h1>
214224
fn main() {
215225
checked::op(1.0, 10.0);
216226
}</code></pre></pre>
217-
<p>Be sure to check the <a href="https://doc.rust-lang.org/std/result/index.html">documentation</a>,
218-
as there are many methods to map/compose <code>Result</code>.</p>
227+
<!--
228+
Be sure to check the [documentation][docs],
229+
as there are many methods to map/compose `Result`.
230+
-->
231+
<p><a href="https://doc.rust-lang.org/std/result/index.html">公式ドキュメント</a>をチェックすることをオススメします。
232+
<code>Result</code>型を扱う関数や<code>Result</code>型のメソッドが多く挙げられています。</p>
219233

220234
</main>
221235

0 commit comments

Comments
 (0)