Skip to content

Commit 6ccdaac

Browse files
authored
Merge pull request #223 from KeenS/1.9-strings
4.17 Strings (1.9)
2 parents fe18028 + 8d81084 commit 6ccdaac

File tree

2 files changed

+11
-41
lines changed

2 files changed

+11
-41
lines changed

1.9/ja/book/strings.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,15 @@ let s = "foo\
6666
assert_eq!("foobar", s);
6767
```
6868

69-
<!-- Rust has more than just `&str`s though. A `String`, is a heap-allocated string. -->
69+
<!-- Note that you normally cannot access a `str` directly, but only through a `&str` -->
70+
<!-- reference. This is because `str` is an unsized type which requires additional -->
71+
<!-- runtime information to be usable. For more information see the chapter on -->
72+
<!-- [unsized types][ut]. -->
73+
通常、`str` には直接アクセス出来ず、 `&str` 参照を通してのみアクセス出来ることに注意して下さい。
74+
これは `str` がサイズ不定型であり追加の実行時情報がないと利用出来ないからです。
75+
詳しくは[サイズ不定型][ut]の章を読んで下さい。
76+
77+
<!-- Rust has more than only `&str`s though. A `String` is a heap-allocated string. -->
7078
<!-- This string is growable, and is also guaranteed to be UTF-8. `String`s are -->
7179
<!-- commonly created by converting from a string slice using the `to_string` -->
7280
<!-- method. -->
@@ -123,7 +131,7 @@ TcpStream::connect(&*addr_string); // addr_string を &str に変換して渡す
123131
<!-- ## Indexing -->
124132
## インデクシング
125133

126-
<!-- Because strings are valid UTF-8, strings do not support indexing: -->
134+
<!-- Because strings are valid UTF-8, they do not support indexing: -->
127135
文字列が正しいUTF-8であるため、文字列はインデクシングをサポートしていません:
128136

129137
```rust,ignore
@@ -241,5 +249,6 @@ let hello_world = hello + &world;
241249
これは、 `&String` が自動的に `&str` に型強制されるためです。
242250
このフィーチャーは 「 [`Deref` による型強制][dc] 」と呼ばれています。
243251

252+
[ut]: unsized-types.html
244253
[dc]: deref-coercions.html
245254
[connect]: ../std/net/struct.TcpStream.html#method.connect

diff-1.6.0..1.9.0/src/doc/book/strings.md

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)