Skip to content

Commit 65775b8

Browse files
committed
generate
1 parent a719264 commit 65775b8

File tree

4 files changed

+31
-20
lines changed

4 files changed

+31
-20
lines changed

public/1.6/book/functions.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,10 @@ <h2 id='式対文' class='section-header'><a href='#式対文'>式対文</a></h2
417417
<p>しかし、Rustでは束縛を導入するための <code>let</code> の使用は式では <em>ありません</em>
418418
次の例はコンパイルエラーを起こします。</p>
419419
<span class='rusttest'>fn main() {
420-
let x = (let y = 5); // expected identifier, found keyword `let`
420+
// let x = (let y = 5); // expected identifier, found keyword `let`
421+
let x = (let y = 5); // 識別子を期待していましたが、キーワード `let` が見付かりました
421422
}</span><pre class='rust rust-example-rendered'>
422-
<span class='kw'>let</span> <span class='ident'>x</span> <span class='op'>=</span> (<span class='kw'>let</span> <span class='ident'>y</span> <span class='op'>=</span> <span class='number'>5</span>); <span class='comment'>// expected identifier, found keyword `let`</span></pre>
423+
<span class='kw'>let</span> <span class='ident'>x</span> <span class='op'>=</span> (<span class='kw'>let</span> <span class='ident'>y</span> <span class='op'>=</span> <span class='number'>5</span>); <span class='comment'>// 識別子を期待していましたが、キーワード `let` が見付かりました</span></pre>
423424

424425
<!--The compiler is telling us here that it was expecting to see the beginning of-->
425426

@@ -443,11 +444,12 @@ <h2 id='式対文' class='section-header'><a href='#式対文'>式対文</a></h2
443444
<span class='rusttest'>fn main() {
444445
let mut y = 5;
445446

446-
let x = (y = 6); // x has the value `()`, not `6`
447+
// let x = (y = 6); // x has the value `()`, not `6`
448+
let x = (y = 6); // xは値 `()` を持っており、 `6` ではありません
447449
}</span><pre class='rust rust-example-rendered'>
448450
<span class='kw'>let</span> <span class='kw-2'>mut</span> <span class='ident'>y</span> <span class='op'>=</span> <span class='number'>5</span>;
449451

450-
<span class='kw'>let</span> <span class='ident'>x</span> <span class='op'>=</span> (<span class='ident'>y</span> <span class='op'>=</span> <span class='number'>6</span>); <span class='comment'>// x has the value `()`, not `6`</span></pre>
452+
<span class='kw'>let</span> <span class='ident'>x</span> <span class='op'>=</span> (<span class='ident'>y</span> <span class='op'>=</span> <span class='number'>6</span>); <span class='comment'>// xは値 `()` を持っており、 `6` ではありません</span></pre>
451453

452454
<!--The second kind of statement in Rust is the *expression statement*. Its-->
453455

@@ -504,14 +506,15 @@ <h2 id='早期リターン' class='section-header'><a href='#早期リターン'
504506
fn foo(x: i32) -&gt; i32 {
505507
return x;
506508

507-
// we never run this code!
509+
// we never run this code!
510+
// このコードは走りません!
508511
x + 1
509512
}
510513
}</span><pre class='rust rust-example-rendered'>
511514
<span class='kw'>fn</span> <span class='ident'>foo</span>(<span class='ident'>x</span>: <span class='ident'>i32</span>) <span class='op'>-&gt;</span> <span class='ident'>i32</span> {
512515
<span class='kw'>return</span> <span class='ident'>x</span>;
513516

514-
<span class='comment'>// we never run this code!</span>
517+
<span class='comment'>// このコードは走りません!</span>
515518
<span class='ident'>x</span> <span class='op'>+</span> <span class='number'>1</span>
516519
}</pre>
517520

public/1.6/book/guessing-game.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,9 @@ <h1 id='予想値を処理する' class='section-header'><a href='#予想値を
448448
<code>let</code>は代入の左辺に名前を取る訳ではなくて実際には<a href="patterns.html">パターン</a>を受け取ります。
449449
後程パターンを使います。簡単なのでもう使えますね。</p>
450450
<span class='rusttest'>fn main() {
451+
// let foo = 5; // immutable.
451452
let foo = 5; // イミュータブル
453+
// let mut bar = 5; // mutable
452454
let mut bar = 5; // ミュータブル
453455
}</span><pre class='rust rust-example-rendered'>
454456
<span class='kw'>let</span> <span class='ident'>foo</span> <span class='op'>=</span> <span class='number'>5</span>; <span class='comment'>// イミュータブル</span>

public/1.6/book/primitive-types.html

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -277,13 +277,13 @@ <h1 id='数値型' class='section-header'><a href='#数値型'>数値型</a></h1
277277

278278
<p>もし数値リテラルがその型を推論させるものを何も持たないのであれば、以下のとおりデフォルトになります。</p>
279279
<span class='rusttest'>fn main() {
280-
let x = 42; // x has type i32
281-
282-
let y = 1.0; // y has type f64
280+
// let x = 42; // x has type i32
281+
let x = 42; // xはi32型を持つ
282+
// let y = 1.0; // y has type f64
283+
let y = 1.0; // yはf64型を持つ
283284
}</span><pre class='rust rust-example-rendered'>
284-
<span class='kw'>let</span> <span class='ident'>x</span> <span class='op'>=</span> <span class='number'>42</span>; <span class='comment'>// x has type i32</span>
285-
286-
<span class='kw'>let</span> <span class='ident'>y</span> <span class='op'>=</span> <span class='number'>1.0</span>; <span class='comment'>// y has type f64</span></pre>
285+
<span class='kw'>let</span> <span class='ident'>x</span> <span class='op'>=</span> <span class='number'>42</span>; <span class='comment'>// xはi32型を持つ</span>
286+
<span class='kw'>let</span> <span class='ident'>y</span> <span class='op'>=</span> <span class='number'>1.0</span>; <span class='comment'>// yはf64型を持つ</span></pre>
287287

288288
<!-- Here’s a list of the different numeric types, with links to their documentation -->
289289

@@ -494,12 +494,14 @@ <h2 id='スライシング構文' class='section-header'><a href='#スライシ
494494
<code>&amp;</code> はスライスが参照と同じであることを示し、 <code>[]</code> はレンジを持ち、スライスの長さを定義します。</p>
495495
<span class='rusttest'>fn main() {
496496
let a = [0, 1, 2, 3, 4];
497-
let complete = &amp;a[..]; // A slice containing all of the elements in a
498-
let middle = &amp;a[1..4]; // A slice of a: just the elements 1, 2, and 3
497+
// let complete = &amp;a[..]; // A slice containing all of the elements in a
498+
let complete = &amp;a[..]; // aに含まれる全ての要素を持つスライス
499+
// let middle = &amp;a[1..4]; // A slice of a: just the elements 1, 2, and 3
500+
let middle = &amp;a[1..4]; // 1、2、3のみを要素に持つaのスライス
499501
}</span><pre class='rust rust-example-rendered'>
500502
<span class='kw'>let</span> <span class='ident'>a</span> <span class='op'>=</span> [<span class='number'>0</span>, <span class='number'>1</span>, <span class='number'>2</span>, <span class='number'>3</span>, <span class='number'>4</span>];
501-
<span class='kw'>let</span> <span class='ident'>complete</span> <span class='op'>=</span> <span class='kw-2'>&amp;</span><span class='ident'>a</span>[..]; <span class='comment'>// A slice containing all of the elements in a</span>
502-
<span class='kw'>let</span> <span class='ident'>middle</span> <span class='op'>=</span> <span class='kw-2'>&amp;</span><span class='ident'>a</span>[<span class='number'>1</span>..<span class='number'>4</span>]; <span class='comment'>// A slice of a: just the elements 1, 2, and 3</span></pre>
503+
<span class='kw'>let</span> <span class='ident'>complete</span> <span class='op'>=</span> <span class='kw-2'>&amp;</span><span class='ident'>a</span>[..]; <span class='comment'>// aに含まれる全ての要素を持つスライス</span>
504+
<span class='kw'>let</span> <span class='ident'>middle</span> <span class='op'>=</span> <span class='kw-2'>&amp;</span><span class='ident'>a</span>[<span class='number'>1</span>..<span class='number'>4</span>]; <span class='comment'>// 1、2、3のみを要素に持つaのスライス</span></pre>
503505

504506
<!-- Slices have type `&[T]`. We’ll talk about that `T` when we cover -->
505507

@@ -630,11 +632,13 @@ <h1 id='タプル' class='section-header'><a href='#タプル'>タプル</a></h1
630632

631633
<p>コンマを付けることで要素1のタプルを丸括弧の中の値と混同しないように明示することができます。</p>
632634
<span class='rusttest'>fn main() {
633-
(0,); // single-element tuple
634-
(0); // zero in parentheses
635+
// (0,); // single-element tuple
636+
(0,); // 1要素のタプル
637+
// (0); // zero in parentheses
638+
(0); // 丸括弧に囲まれたゼロ
635639
}</span><pre class='rust rust-example-rendered'>
636-
(<span class='number'>0</span>,); <span class='comment'>// single-element tuple</span>
637-
(<span class='number'>0</span>); <span class='comment'>// zero in parentheses</span></pre>
640+
(<span class='number'>0</span>,); <span class='comment'>// 1要素のタプル</span>
641+
(<span class='number'>0</span>); <span class='comment'>// 丸括弧に囲まれたゼロ</span></pre>
638642

639643
<!-- ## Tuple Indexing -->
640644

public/1.6/book/structs.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,10 @@ <h1 class="title">構造体</h1>
307307

308308
point.x = 5;
309309

310+
// let point = point; // this new binding can’t change now
310311
let point = point; // この新しい束縛でここから変更できなくなります
311312

313+
// point.y = 6; // this causes an error
312314
point.y = 6; // これはエラーになります
313315
}
314316
</span><pre class='rust rust-example-rendered'>

0 commit comments

Comments
 (0)