Skip to content

Commit fb31d86

Browse files
committed
ci: generate pages at e610f7d [ci skip]
1 parent e610f7d commit fb31d86

File tree

1 file changed

+38
-37
lines changed

1 file changed

+38
-37
lines changed

docs/1.6/book/strings.html

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ <h1 class="title">文字列</h1>
198198

199199
<!-- strings also work differently than in some other systems languages, such as C. -->
200200

201-
<p>文字列は、プログラマがマスタすべき重要なコンセプトです
202-
Rustの文字列の扱いは、Rust言語がシステムにフォーカスしているため、少し他の言語と異なります。
203-
動的なサイズを持つデータ構造が有る時、常に物事は複雑になります
201+
<p>文字列は、プログラマがマスタすべき重要な概念です
202+
Rustの文字列の扱いは、Rust言語がシステムプログラミングにフォーカスしているため、少し他の言語と異なります。
203+
動的なサイズを持つデータ構造があるといつも、物事は複雑性を孕みます
204204
そして文字列もまたサイズを変更することができるデータ構造です。
205-
これはつまり、Rustの文字列もまた、Cのような他のシステム言語とは少し異なるということです</p>
205+
これはつまり、Rustの文字列もまた、Cのような他のシステム言語とは少し異なる振る舞いをするということです</p>
206206

207207
<!-- Let’s dig into the details. A ‘string’ is a sequence of Unicode scalar values -->
208208

@@ -212,19 +212,19 @@ <h1 class="title">文字列</h1>
212212

213213
<!-- strings are not null-terminated and can contain null bytes. -->
214214

215-
<p>詳しく見ていきましょう「文字列」は、UTF-8のバイトストリームとしてエンコードされたユニコードのスカラ値のシーケンスです。
216-
すべての文字列は、正しくエンコードされたUTF-8のシーケンスであることが保証されています。
217-
また、他のシステム言語とはことなり、文字列はnull終端でなく、nullバイトを含むことが可能です</p>
215+
<p>詳しく見ていきましょう「文字列」は、UTF-8のバイトストリームとしてエンコードされたユニコードのスカラ値のシーケンスです。
216+
すべての文字列は、妥当なUTF-8のシーケンスであることが保証されています。
217+
また、他のシステム言語とは異なり、文字列はnull終端でなく、nullバイトを保持することもできます</p>
218218

219219
<!-- Rust has two main types of strings: `&str` and `String`. Let’s talk about -->
220220

221221
<!-- `&str` first. These are called ‘string slices’. A string slice has a fixed -->
222222

223223
<!-- size, and cannot be mutated. It is a reference to a sequence of UTF-8 bytes. -->
224224

225-
<p>Rustは主要な文字列型を二種類持っています: <code>&amp;str</code><code>String</code>です。
226-
まず <code>&amp;str</code> について説明しましょう。 <code>&amp;str</code> は「文字列のスライス」と呼ばれます。
227-
文字列のスライスは固定のサイズを持ち、変更不可能です。そして、文字列のスライスはUTF-8のバイトシーケンスへの参照です。</p>
225+
<p>Rustには主要な文字列型が二種類あります。<code>&amp;str</code><code>String</code>です。
226+
まず <code>&amp;str</code> について説明しましょう。 <code>&amp;str</code> は「文字列スライス」と呼ばれます。
227+
文字列スライスは固定サイズで変更不可能です。文字列スライスはUTF-8のバイトシーケンスへの参照です。</p>
228228

229229
<span class='rusttest'>fn main() {
230230
let greeting = &quot;Hello there.&quot;; // greeting: &amp;&#39;static str
@@ -241,18 +241,19 @@ <h1 class="title">文字列</h1>
241241

242242
<!-- function expecting a string slice will also accept a string literal. -->
243243

244-
<p><code>&quot;Hello there.&quot;</code> は文字列リテラルであり、 <code>&amp;&#39;static str</code> 型を持ちます。
245-
文字列リテラルは、静的にアロケートされた文字列のスライスであり、これはつまりコンパイルされたプログラム中に保存されており、
246-
プログラムの実行中全てにわたって存在していることを意味しています。
247-
どの文字列のスライスを引数として期待している関数も、文字列リテラルを引数に取ることができます。</p>
244+
<p><code>&quot;Hello there.&quot;</code> は文字列リテラルで、 <code>&amp;&#39;static str</code> 型を持ちます。
245+
文字列リテラルは、静的にアロケートされた文字列スライスです。これはつまりコンパイルされたプログラム内に保存されていて、
246+
プログラムの実行中全てにわたって存在しているということです。
247+
<code>greeting</code>の束縛はこのように静的にアロケートされた文字列を参照しています。
248+
文字列スライスを引数として期待している関数はすべて文字列リテラルを引数に取ることができます。</p>
248249

249250
<!-- String literals can span multiple lines. There are two forms. The first will -->
250251

251252
<!-- include the newline and the leading spaces: -->
252253

253-
<p>文字列リテラルは複数行に渡ることができます
254-
複数行の文字列リテラルを記述する方法は、2つの形式があります
255-
一つ目の形式は、改行と行頭の空白を文字列に含む形式です:</p>
254+
<p>文字列リテラルは複数行にわたることができます
255+
複数行文字列リテラルには2つの形式があります
256+
一つ目の形式は、改行と行頭の空白を含む形式です:</p>
256257

257258
<span class='rusttest'>fn main() {
258259
let s = &quot;foo
@@ -267,7 +268,7 @@ <h1 class="title">文字列</h1>
267268

268269
<!-- The second, with a `\`, trims the spaces and the newline: -->
269270

270-
<p>もう一つは <code>\</code> を用いて、空白と改行を削る形式です:</p>
271+
<p>もう一つは <code>\</code> を使って空白と改行を削る形式です:</p>
271272

272273
<span class='rusttest'>fn main() {
273274
let s = &quot;foo\
@@ -288,9 +289,9 @@ <h1 class="title">文字列</h1>
288289

289290
<!-- method. -->
290291

291-
<p>Rustは <code>&amp;str</code> だけでなく、 <code>String</code> というヒープにアロケートされる文字列の形式も持っています
292-
この文字列は伸張可能であり、またUTF-8であることが保証されています
293-
<code>String</code> は一般的に文字列のスライスをメソッド <code>to_string</code> を用いて変換することで生成されます</p>
292+
<p>Rustには <code>&amp;str</code> だけでなく、 <code>String</code> というヒープアロケートされる文字列もあります
293+
この文字列は伸張可能であり、またUTF-8であることも保証されています
294+
<code>String</code> は一般的に文字列スライスを <code>to_string</code> メソッドで変換することで作成されます</p>
294295

295296
<span class='rusttest'>fn main() {
296297
let mut s = &quot;Hello&quot;.to_string(); // mut s: String
@@ -335,9 +336,9 @@ <h1 class="title">文字列</h1>
335336

336337
<!-- converted using `&*`. -->
337338

338-
<p>このような変換は <code>&amp;str</code> の代わりに、 <code>&amp;str</code> のトレイトを引数として期待している関数では自動的には行われません
339+
<p>このような変換は <code>&amp;str</code> ではなく <code>&amp;str</code> の実装するトレイトを引数として取る関数に対しては自動的には行われません
339340
たとえば、 <a href="../std/net/struct.TcpStream.html#method.connect"><code>TcpStream::connect</code></a> は引数として型 <code>ToSocketAddrs</code> を要求しています。
340-
このような関数には <code>&amp;str</code> は渡せますが、 <code>String</code><code>&amp;*</code> を用いて明示的に変換する必要があります</p>
341+
このような関数には <code>&amp;str</code> は渡せますが、 <code>String</code><code>&amp;*</code> を用いて明示的に変換しなければなりません</p>
341342

342343
<span class='rusttest'>fn main() {
343344
use std::net::TcpStream;
@@ -360,15 +361,15 @@ <h1 class="title">文字列</h1>
360361

361362
<!-- `String` involves allocating memory. No reason to do that unless you have to! -->
362363

363-
<p><code>String</code><code>&amp;str</code> として見るコストは低いですが<code>&amp;str</code><code>String</code> に変換するのはメモリのアロケーションを発生させます
364-
必要がなければ、やるべきではないでしょう!</p>
364+
<p><code>String</code><code>&amp;str</code> として見るコストは低いのですが<code>&amp;str</code><code>String</code> に変換するとメモリアロケーションが発生します
365+
必要がなければ、やるべきではないでしょう</p>
365366

366367
<!-- ## Indexing -->
367368

368369
<h2 id='インデクシング' class='section-header'><a href='#インデクシング'>インデクシング</a></h2>
369370
<!-- Because strings are valid UTF-8, strings do not support indexing: -->
370371

371-
<p>文字列が正しいUTF-8であるため、文字列はインデクシングをサポートしていません:</p>
372+
<p>文字列は妥当なUTF-8であるため、文字列はインデクシングをサポートしていません:</p>
372373

373374
<span class='rusttest'>fn main() {
374375
let s = &quot;hello&quot;;
@@ -393,11 +394,11 @@ <h2 id='インデクシング' class='section-header'><a href='#インデクシ
393394
<!-- individual bytes, or as codepoints:-->
394395

395396
<p>普通、ベクタへの <code>[]</code> を用いたアクセスはとても高速です。
396-
しかし、UTF-8にエンコードされた文字列中の一つ一つの文字は複数のバイトであることが可能なため
397-
文字列のn番の文字を探すためには文字列上を移動していく必要があります
398-
そのような作業はとても高コストな演算であり、誤解してはならない点です
399-
さらに言えば、「文字」というものはUnicodeにおいては正確に定義されていません
400-
文字列を、それぞれのバイトとして見ることも、コードポイントの集まりとして見ることもできるのです</p>
397+
しかし、UTF-8でエンコードされた文字列内の文字は複数のバイト対応することがあるため
398+
文字列のn番目の文字を探すには文字列上を走査していく必要があります
399+
そのような処理はベクタのアクセスに比べると非常に高コストな演算であり、誤解を招きたくなかったのです
400+
さらに言えば、上の「文字 (letter)」というのはUnicodeでの定義と厳密には一致しません
401+
文字列をバイト列として見るかコードポイント列として見るか選ぶことができます</p>
401402

402403
<span class='rusttest'>fn main() {
403404
let hachiko = &quot;忠犬ハチ公&quot;;
@@ -452,12 +453,12 @@ <h2 id='インデクシング' class='section-header'><a href='#インデクシ
452453

453454
<!-- This emphasizes that we have to walk from the beginning of the list of `chars`. -->
454455

455-
<p>このコードは、<code>chars</code> のリストの上を移動している事を強調しています</p>
456+
<p>このコードは、<code>chars</code> のリストの上を先頭から走査しなければならないことを強調しています</p>
456457

457458
<h2 id='スライシング' class='section-header'><a href='#スライシング'>スライシング</a></h2>
458459
<!-- You can get a slice of a string with slicing syntax: -->
459460

460-
<p>文字列のスライスは以下のようにスライス構文を用いて取得することができます:</p>
461+
<p>文字列スライスは以下のようにスライス構文を使って取得することができます:</p>
461462

462463
<span class='rusttest'>fn main() {
463464
let dog = &quot;hachiko&quot;;
@@ -490,10 +491,10 @@ <h2 id='スライシング' class='section-header'><a href='#スライシング'
490491

491492
<!-- ## Concatenation -->
492493

493-
<h2 id='結合' class='section-header'><a href='#結合'>結合</a></h2>
494+
<h2 id='連結' class='section-header'><a href='#連結'>連結</a></h2>
494495
<!-- If you have a `String`, you can concatenate a `&str` to the end of it: -->
495496

496-
<p><code>String</code> が存在するとき、 <code>&amp;str</code> を末尾に結合することができます:</p>
497+
<p><code>String</code> が存在するとき、 <code>&amp;str</code> を末尾に連結することができます:</p>
497498

498499
<span class='rusttest'>fn main() {
499500
let hello = &quot;Hello &quot;.to_string();
@@ -508,7 +509,7 @@ <h2 id='結合' class='section-header'><a href='#結合'>結合</a></h2>
508509

509510
<!-- But if you have two `String`s, you need an `&`: -->
510511

511-
<p>しかし、2つの <code>String</code> を結合するには<code>&amp;</code> が必要になります:</p>
512+
<p>しかし、2つの <code>String</code> を連結するには<code>&amp;</code> が必要になります:</p>
512513

513514
<span class='rusttest'>fn main() {
514515
let hello = &quot;Hello &quot;.to_string();
@@ -526,7 +527,7 @@ <h2 id='結合' class='section-header'><a href='#結合'>結合</a></h2>
526527
<!-- feature called ‘[`Deref` coercions][dc]’. -->
527528

528529
<p>これは、 <code>&amp;String</code> が自動的に <code>&amp;str</code> に型強制されるためです。
529-
このフィーチャーは<a href="deref-coercions.html"><code>Deref</code> による型強制</a> 」と呼ばれています。</p>
530+
このフィーチャは<a href="deref-coercions.html"><code>Deref</code> による型強制</a> 」と呼ばれています。</p>
530531

531532
<script type="text/javascript">
532533
window.playgroundUrl = "https://play.rust-lang.org";

0 commit comments

Comments
 (0)