File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -17,17 +17,32 @@ let s: &'static str = "hello world";
17
17
fn generic<T>(x: T) where T: 'static {}
18
18
```
19
19
20
+ <!--
20
21
Both are related but subtly different and this is a common source for
21
22
confusion when learning Rust. Here are some examples for each situation:
23
+ -->
24
+ 2つの状況における` static ` は微妙に異なる意味を持っており、Rustを学ぶときの混乱の元になっています。
25
+ いくつかの例とともにそれぞれの状況について見てみましょう。
22
26
27
+ <!--
23
28
## Reference lifetime
29
+ -->
30
+ ## 参照のライフタイム
24
31
32
+ <!--
25
33
As a reference lifetime `'static` indicates that the data pointed to by
26
34
the reference lives for the entire lifetime of the running program.
27
35
It can still be coerced to a shorter lifetime.
36
+ -->
37
+ 参照のライフタイムが` 'static ` であることは、参照が指し示すデータがプログラムの実行中に渡って生き続けることを示します。
38
+ また、より短いライフタイムに強制することも可能です。
28
39
40
+ <!--
29
41
There are two ways to make a variable with `'static` lifetime, and both
30
42
are stored in the read-only memory of the binary:
43
+ -->
44
+ ` 'static ` ライフタイムを持つ変数を作るには下記の2つ方法があります。
45
+ どちらの場合も、データは読み取り専用のメモリ領域に格納されます。
31
46
32
47
<!--
33
48
* Make a constant with the `static` declaration.
You can’t perform that action at this time.
0 commit comments