Skip to content

Commit 3153a64

Browse files
committed
ci: generate pages at efd044a [ci skip]
1 parent efd044a commit 3153a64

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

public/1.9/book/references-and-borrowing.html

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,15 @@ <h1 id='概論' class='section-header'><a href='#概論'>概論</a></h1>
227227

228228
<!-- as possible in order to make them work. The ownership system is a prime example -->
229229

230-
<!-- of a zero cost abstraction. All of the analysis we’ll talk about in this guide -->
230+
<!-- of a zero-cost abstraction. All of the analysis we’ll talk about in this guide -->
231231

232232
<!-- is _done at compile time_. You do not pay any run-time cost for any of these -->
233233

234234
<!-- features. -->
235235

236236
<p>Rustは安全性とスピートに焦点を合わせます。
237-
Rustはそれらの目標をたくさんの「ゼロコスト抽象化」を通じて成し遂げます。それは、Rustでは抽象化を機能させるためのコストをできる限り小さくすることを意味します。
237+
Rustはそれらの目標を、様々な「ゼロコスト抽象化」を通じて成し遂げます。
238+
それは、Rustでは抽象化を機能させるためのコストをできる限り小さくすることを意味します。
238239
所有権システムはゼロコスト抽象化の主な例です。
239240
このガイドの中で話すであろう解析の全ては <em>コンパイル時に行われます</em>
240241
それらのどの機能に対しても実行時のコストは全く掛かりません。</p>
@@ -258,9 +259,11 @@ <h1 id='概論' class='section-header'><a href='#概論'>概論</a></h1>
258259
<!-- checker less and less. -->
259260

260261
<p>しかし、このシステムはあるコストを持ちます。それは学習曲線です。
261-
多くの新しいRustのユーザは「借用チェッカとの戦い」と好んで呼ばれるものを経験します。そこではRustコンパイラが開発者が正しいと考えるプログラムをコンパイルすることを拒絶します。
262+
多くのRust入門者は、私たちが「借用チェッカとの戦い」と呼ぶものを経験します。
263+
そこではRustコンパイラが、開発者が正しいと考えるプログラムをコンパイルすることを拒絶します。
262264
所有権がどのように機能するのかについてのプログラマのメンタルモデルがRustの実装する実際のルールにマッチしないため、これはしばしば起きます。
263-
しかし、よいニュースがあります。より経験豊富なRustの開発者は次のことを報告します。一度彼らが所有権システムのルールとともにしばらく仕事をすれば、彼らが借用チェッカと戦うことは少なくなっていくということです。</p>
265+
しかし、よいニュースがあります。より経験豊富なRustの開発者は次のことを報告します。
266+
それは、所有権システムのルールと共にしばらく仕事をすれば、借用チェッカと戦うことは次第に少なくなっていく、というものです。</p>
264267

265268
<!-- With that in mind, let’s learn about borrowing. -->
266269

@@ -359,11 +362,11 @@ <h1 id='借用' class='section-header'><a href='#借用'>借用</a></h1>
359362
何かを借用した束縛はそれがスコープから外れるときにリソースを割当解除しません。
360363
これは <code>foo()</code> の呼出しの後に元の束縛を再び使うことができることを意味します。</p>
361364

362-
<!-- References are immutable, just like bindings. This means that inside of `foo()`, -->
365+
<!-- References are immutable, like bindings. This means that inside of `foo()`, -->
363366

364367
<!-- the vectors can’t be changed at all: -->
365368

366-
<p>参照は束縛とちょうど同じようにイミュータブルです
369+
<p>参照は束縛と同じようにイミュータブルです
367370
これは <code>foo()</code> の中ではベクタは全く変更できないことを意味します。</p>
368371

369372
<span class='rusttest'>fn main() {
@@ -404,7 +407,7 @@ <h1 id='mut参照' class='section-header'><a href='#mut参照'>&amp;mut参照</a
404407
<!-- to mutate the resource you’re borrowing. For example: -->
405408

406409
<p>参照には2つ目の種類、 <code>&amp;mut T</code> があります。
407-
「ミュータブルな参照」によって借用しているリソースを変更することができるようになります
410+
「ミュータブルな参照」によって借用しているリソースを変更できるようになります
408411
例は次のとおりです。</p>
409412

410413
<span class='rusttest'>fn main() {
@@ -428,29 +431,29 @@ <h1 id='mut参照' class='section-header'><a href='#mut参照'>&amp;mut参照</a
428431

429432
<!-- If it wasn’t, we couldn’t take a mutable borrow to an immutable value. -->
430433

431-
<p>これは <code>6</code> をプリントするでしょう
434+
<p>これは <code>6</code> を表示するでしょう
432435
<code>y</code><code>x</code> へのミュータブルな参照にして、それから <code>y</code> の指示先に1を足します。
433436
<code>x</code><code>mut</code> とマークしなければならないことに気付くでしょう。
434437
そうしないと、イミュータブルな値へのミュータブルな借用ということになってしまい、使うことができなくなってしまいます。</p>
435438

436439
<!-- You'll also notice we added an asterisk (`*`) in front of `y`, making it `*y`, -->
437440

438-
<!-- this is because `y` is an `&mut` reference. You'll also need to use them for -->
441+
<!-- this is because `y` is a `&mut` reference. You'll also need to use them for -->
439442

440443
<!-- accessing the contents of a reference as well. -->
441444

442445
<p>アスタリスク( <code>*</code> )を <code>y</code> の前に追加して、それを <code>*y</code> にしたことにも気付くでしょう。これは、 <code>y</code><code>&amp;mut</code> 参照だからです。
443446
参照の内容にアクセスするためにもそれらを使う必要があるでしょう。</p>
444447

445-
<!-- Otherwise, `&mut` references are just like references. There _is_ a large -->
448+
<!-- Otherwise, `&mut` references are like references. There _is_ a large -->
446449

447450
<!-- difference between the two, and how they interact, though. You can tell -->
448451

449452
<!-- something is fishy in the above example, because we need that extra scope, with -->
450453

451454
<!-- the `{` and `}`. If we remove them, we get an error: -->
452455

453-
<p>それ以外は、 <code>&amp;mut</code> 参照は普通の参照と全く同じです
456+
<p>それ以外は、 <code>&amp;mut</code> 参照は普通の参照と同じです
454457
しかし、2つの間には、そしてそれらがどのように相互作用するかには大きな違いが <em>あります</em>
455458
前の例で何かが怪しいと思ったかもしれません。なぜなら、 <code>{</code><code>}</code> を使って追加のスコープを必要とするからです。
456459
もしそれらを削除すれば、次のようなエラーが出ます。</p>
@@ -498,9 +501,9 @@ <h1 id='ルール' class='section-header'><a href='#ルール'>ルール</a></h1
498501
<li>ただ1つのミュータブルな参照( <code>&amp;mut T</code></li>
499502
</ul>
500503

501-
<!-- You may notice that this is very similar, though not exactly the same as, -->
504+
<!-- You may notice that this is very similar to, though not exactly the same as, -->
502505

503-
<!-- to the definition of a data race: -->
506+
<!-- the definition of a data race: -->
504507

505508
<p>これがデータ競合の定義と非常に似ていることに気付くかもしれません。全く同じではありませんが。</p>
506509

@@ -580,14 +583,17 @@ <h2 id='スコープの考え方' class='section-header'><a href='#スコープ
580583

581584
<!-- In other words, the mutable borrow is held through the rest of our example. What -->
582585

583-
<!-- we want is for the mutable borrow to end _before_ we try to call `println!` and -->
586+
<!-- we want is for the mutable borrow by `y` to end so that the resource can be -->
584587

585-
<!-- make an immutable borrow. In Rust, borrowing is tied to the scope that the -->
588+
<!-- returned to the owner, `x`. `x` can then provide a immutable borrow to `println!`. -->
586589

587-
<!-- borrow is valid for. And our scopes look like this: -->
590+
<!-- In Rust, borrowing is tied to the scope that the borrow is valid for. And our -->
588591

589-
<p>言い換えると、ミュータブルな借用は先程の例の残りの間ずっと保持されるということです。
590-
必要なものは、 <code>println!</code> を呼び出し、イミュータブルな借用を作ろうとする <em>前に</em> 終わるミュータブルな借用です。
592+
<!-- scopes look like this: -->
593+
594+
<p>言い換えると、ミュータブルな借用は、先ほどの例の残りの間、ずっと保持されるということです。
595+
ここで私たちが求めているのは、<code>y</code> によるミュータブルな借用が終わり、リソースがその所有者である <code>x</code> に返却されることです。
596+
そうすれば <code>x</code><code>println!</code> にイミュータブルな借用を提供できるわけです。
591597
Rustでは借用はその有効なスコープと結び付けられます。
592598
そしてスコープはこのように見えます。</p>
593599

@@ -651,9 +657,9 @@ <h2 id='スコープの考え方' class='section-header'><a href='#スコープ
651657

652658
<!-- immutable one. But scope is the key to seeing how long a borrow lasts for. -->
653659

654-
<p>問題ありません
660+
<p>これなら問題ありません
655661
ミュータブルな借用はイミュータブルな借用を作る前にスコープから外れます。
656-
しかしスコープは借用がどれくらい存続するのか理解するための鍵となります</p>
662+
しかしスコープは、借用がどれくらい存続するのか理解するための鍵となります</p>
657663

658664
<!-- ## Issues borrowing prevents -->
659665

@@ -692,13 +698,13 @@ <h3 id='イテレータの無効' class='section-header'><a href='#イテレー
692698
<span class='macro'>println</span><span class='macro'>!</span>(<span class='string'>&quot;{}&quot;</span>, <span class='ident'>i</span>);
693699
}</pre>
694700

695-
<!-- This prints out one through three. As we iterate through the vectors, we’re -->
701+
<!-- This prints out one through three. As we iterate through the vector, we’re -->
696702

697703
<!-- only given references to the elements. And `v` is itself borrowed as immutable, -->
698704

699705
<!-- which means we can’t change it while we’re iterating: -->
700706

701-
<p>これは1から3までをプリントアウトします
707+
<p>これは1から3までを表示します
702708
ベクタに対して繰り返すとき、要素への参照だけを受け取ります。
703709
そして、 <code>v</code> はそれ自体イミュータブルとして借用され、それは繰返しを行っている間はそれを変更できないことを意味します。</p>
704710

0 commit comments

Comments
 (0)