Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cd1917d

Browse files
committedFeb 3, 2016
update translation
1 parent efadad9 commit cd1917d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎1.6/ja/book/box-syntax-and-patterns.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<!-- Also it is not possible in stable Rust to destructure a `Box` in a match -->
66
<!-- pattern. The unstable `box` keyword can be used to both create and destructure -->
77
<!-- a `Box`. An example usage would be: -->
8-
今のところ、stableにおいて `Box` を作成する唯一の方法は `Box::new` メソッドです。stableなRustではパターンマッチで `Box` を分解することもできません。unstableな `box` キーワードは `Box` の作成と分解の両方に使えます。使い方は以下の通りです。
8+
今のところ、安定版において `Box` を作成する唯一の方法は `Box::new` メソッドです。安定版のRustではパターンマッチで `Box` を分解することもできません。不安定版の `box` キーワードは `Box` の作成と分解の両方に使えます。使い方は以下の通りです。
99

1010
```rust
1111
#![feature(box_syntax, box_patterns)]
@@ -102,7 +102,7 @@ fn main() {
102102
<!-- smarter than that. There is no copy in this code. `main` allocates enough room -->
103103
<!-- for the `box`, passes a pointer to that memory into `foo` as `x`, and then -->
104104
<!-- `foo` writes the value straight into the `Box<T>`. -->
105-
このコードはひどいパフォーマンス低下をもたらすと感じるかもしれません。値を返して即座にboxに入れるなんて?! このパターンは悪いところどりになっているのでは? Rustはもう少し賢いため、このコードでコピーは発生しません。 `main` では `box` のために十分な領域を確保し、そのメモリへのポインタを `foo``x` として渡します。 `foo` はその値を直接 `Box<T>` (訳注: すなわち `y` )の中に書き込みます。
105+
このコードはひどいパフォーマンス低下をもたらすと感じるかもしれません。値を返して即座にboxに入れるなんて?! このパターンは悪いところどりになっているのでは? Rustはもう少し賢いため、このコードでコピーは発生しません。 `main` 内では `box` のために十分なメモリ領域を確保し、そのメモリへのポインタを `foo``x` として渡します。 `foo` はその値を直接 `Box<T>` (訳注: すなわち `y` )の中に書き込みます。
106106

107107
<!-- This is important enough that it bears repeating: pointers are not for -->
108108
<!-- optimizing returning values from your code. Allow the caller to choose how they -->

0 commit comments

Comments
 (0)
Please sign in to comment.