The Why, What, and How of Pinning in Rust
Jon Gjengset3 HN recommenders · recommended in 3 months, 2021-2026
87K views · 7 years ago · tutorial · evergreen
Jon Gjengset's long live-coding stream explains Rust's Pin and Unpin types: why they exist, how they work, and how they connect to futures and async/await. It also covers moving from pre-pinning code to the new model.
HN treats it as the definitive resource for understanding Pin semantics and lists it among async Rust learning materials.
2:34:01Crust of Rust: async/await
Jon Gjengset
246K views • 5 years ago
48:46Rust's Journey to Async/Await
InfoQ
90K views • 7 years ago
1:33:23Crust of Rust: Lifetime Annotations
Jon Gjengset
299K views • 6 years ago
32:24RustLatam 2019 - Without Boats: Zero-Cost Async IO
Rust Programming Language
55K views • 7 years ago
55:08Rust: A Language for the Next 40 Years - Carol Nichols
ChariotSolutions
367K views • 7 years ago
29:25Rust NYC: Jon Gjengset - Demystifying unsafe code
Rust Programming Language
27K views • 6 years ago
1:02:49Hacking with Andrew and Brad: tip.golang.org
The Go Programming Language
99K views • 11 years ago
52:54Rust at speed — building a fast concurrent database
Jon Gjengset
225K views • 7 years ago
48:19GopherCon 2014 Inside the Gophers Studio with Blake Mizerany
Confreaks
8K views • 12 years ago
4:09:16Implementing (part of) a BitTorrent client in Rust
Jon Gjengset
115K views • 3 years ago
49:20Modeling Data Concurrency w/ Asynchronous I/O in Zig - RedisConf 2020
Redis
11K views • 6 years ago
56:36GopherCon 2014 Opening Keynote by Rob Pike
Confreaks
38K views • 12 years ago
1:05:56Lang NEXT 2014 Panel Systems Programming in 2014 and Beyond
25msr
3K views • 8 years ago
59:26The Go Programming Language
Google TechTalks
406K views • 17 years ago
1:00:23[#36] Zig Roadmap 2024 - Andrew Kelley
Zig SHOWTIME
66K views • 2 years ago
1:29:49Going Native 2012 Keynote Stroustrup
savage309
33K views • 14 years ago
12:31OSCON 2010: Rob Pike, "Public Static Void"
O'Reilly
119K views • 16 years ago
38:19Origins of Go Concurrency style by Rob Pike
jasonofthel33t
28K views • 14 years ago
39:03RustConf 2020 - Closing Keynote by Siân Griffin
Rust Programming Language
10K views • 6 years ago
1:32:33C++ and Beyond 2012: Herb Sutter - atomic Weapons 2 of 2
alexsmail
29K views • 9 years ago
3 comments from Hacker News
there is a chapter on async in comprehensive rust and rustbook which ought to bring you up to speed there is the async book but it is largely unfinished you can watch John Gjengset's crust of rust async, decrusting tokio, and why what, and how of pinning in rust then there are tokio-lessons and tokio tutorial which teach how to use tokio runtime and there are also good blogposts by phil-oop and rose wright on how async works link link link link link ▶ this video link link link link
Jon Gjengset's stream on pin/unpin is invaluable for understanding Pin semantics: ▶ this video But the 10000 ft view is: Pin lets you tell Rust to never ever move a piece of memory. This is almost always done because the piece of memory has pointers into itself (it's self referencial) which would be come invalid if moved.
Let's assume for a moment self-referential references were allowed. Let's further say we have such a struct containing self-referential references and we move it. Moving actually moves things in memory, including the thing those references reference. This means the references now point at the old and now incorrect location. Accessing them would trigger undefined behavior. Self-referencing is only acceptable, if the struct is guaranteed not to move. Rust does provide a mechanism to provide such a guarantee with std::pin but outside of async code, you probably don't want to be using it. std::pin: link If you're curious about pinning and have a few hours to spare, ▶ this video is a great video that explains it in detail.