File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 6
6
data even when there are immutable references to that data; normally, this
7
7
action is disallowed by the borrowing rules. To mutate data, the pattern uses
8
8
` unsafe ` code inside a data structure to bend Rust’s usual rules that govern
9
- mutation and borrowing. We haven’t yet covered unsafe code; we will in Chapter
10
- 19 . We can use types that use the interior mutability pattern when we can
11
- ensure that the borrowing rules will be followed at runtime, even though the
12
- compiler can’t guarantee that. The ` unsafe ` code involved is then wrapped in a
13
- safe API, and the outer type is still immutable.
9
+ mutation and borrowing. We haven’t yet covered unsafe code; we will in
10
+ Chapter 19. We can use types that use the interior mutability pattern when we
11
+ can ensure that the borrowing rules will be followed at runtime, even though
12
+ the compiler can’t guarantee that. The ` unsafe ` code involved is then wrapped
13
+ in a safe API, and the outer type is still immutable.
14
14
15
15
Let’s explore this concept by looking at the ` RefCell<T> ` type that follows the
16
16
interior mutability pattern.
You can’t perform that action at this time.
0 commit comments