Rollup merge of #25963 - steveklabnik:link_to_cell, r=alexcrichton
This commit is contained in:
commit
f90aecff76
@ -159,7 +159,7 @@ b.x = 10; // error: cannot assign to immutable field `b.x`
|
|||||||
|
|
||||||
[struct]: structs.html
|
[struct]: structs.html
|
||||||
|
|
||||||
However, by using `Cell<T>`, you can emulate field-level mutability:
|
However, by using [`Cell<T>`][cell], you can emulate field-level mutability:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
@ -176,4 +176,6 @@ point.y.set(7);
|
|||||||
println!("y: {:?}", point.y);
|
println!("y: {:?}", point.y);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[cell]: ../std/cell/struct.Cell.html
|
||||||
|
|
||||||
This will print `y: Cell { value: 7 }`. We’ve successfully updated `y`.
|
This will print `y: Cell { value: 7 }`. We’ve successfully updated `y`.
|
||||||
|
Loading…
Reference in New Issue
Block a user