]>
Commit | Line | Data |
---|---|---|
f035d41b XL |
1 | # Pinning |
2 | ||
3 | ![Minimum Rust version: 1.33](https://img.shields.io/badge/Minimum%20Rust%20Version-1.33-brightgreen.svg) | |
4 | ||
5 | Rust 1.33 introduced a new concept, implemented as two types: | |
6 | ||
7 | * [`Pin<P>`](https://doc.rust-lang.org/std/pin/struct.Pin.html), a wrapper | |
8 | around a kind of pointer which makes that pointer "pin" its value in place, | |
9 | preventing the value referenced by that pointer from being moved. | |
10 | * [`Unpin`](https://doc.rust-lang.org/std/marker/trait.Unpin.html), types that | |
11 | are safe to be moved, even if they're pinned. | |
12 | ||
13 | Most users will not interact with pinning directly, and so we won't explain | |
14 | more here. For the details, see the [documentation for | |
15 | `std::pin`](https://doc.rust-lang.org/std/pin/index.html). | |
16 | ||
17 | What *is* useful to know about pinning is that it's a pre-requisite for | |
18 | `async`/`await`. Folks who write async libraries may need to learn about | |
19 | pinning, but folks using them generally shouldn't need to interact with this | |
20 | feature at all. | |
21 |