]> git.proxmox.com Git - rustc.git/blame - src/doc/edition-guide/src/rust-next/pin.md
New upstream version 1.53.0+dfsg1
[rustc.git] / src / doc / edition-guide / src / rust-next / pin.md
CommitLineData
f035d41b
XL
1# Pinning
2
3![Minimum Rust version: 1.33](https://img.shields.io/badge/Minimum%20Rust%20Version-1.33-brightgreen.svg)
4
5Rust 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
13Most users will not interact with pinning directly, and so we won't explain
14more here. For the details, see the [documentation for
15`std::pin`](https://doc.rust-lang.org/std/pin/index.html).
16
17What *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
19pinning, but folks using them generally shouldn't need to interact with this
20feature at all.
21