File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -36,22 +36,31 @@ lifetimes relate to scopes, as well as how the two differ.
36
36
// のスコープを完全に包含します。`borrow1`と`borrow2`の存続期間は一切重なりません。
37
37
fn main() {
38
38
let i = 3; // Lifetime for `i` starts. ────────────────┐
39
+ // `i`のライフタイム開始 │
39
40
// │
40
41
{ // │
41
42
let borrow1 = &i; // `borrow1` lifetime starts. ──┐│
43
+ // `borrow1`のライフタイム開始 ││
42
44
// ││
43
45
println!("borrow1: {}", borrow1); // ││
44
46
} // `borrow1` ends. ─────────────────────────────────┘│
47
+ // `borrow1`終了 │
45
48
// │
46
49
// │
47
50
{ // │
48
51
let borrow2 = &i; // `borrow2` lifetime starts. ──┐│
52
+ // `borrow2`のライフタイム開始 ││
49
53
// ││
50
54
println!("borrow2: {}", borrow2); // ││
51
55
} // `borrow2` ends. ─────────────────────────────────┘│
56
+ // `borrow2`終了 │
52
57
// │
53
58
} // Lifetime ends. ─────────────────────────────────────┘
59
+ // ライフタイム終了
54
60
```
55
61
62
+ <!--
56
63
Note that no names or types are assigned to label lifetimes.
57
64
This restricts how lifetimes will be able to be used as we will see.
65
+ -->
66
+ ここで、一切の名前や型がライフタイムにアサインされていないことに注意しましょう。これにより、ライフタイムの使われ方がこれから見ていくようなやり方に制限されます。
You can’t perform that action at this time.
0 commit comments