Video and slides synchronized, mp3 and slide download available at URL https://bit.ly/344PnB1.
Steve Klabnik goes over the deep details of how async/await works in Rust, covering concepts like coroutines, generators, stack-less vs stack-ful, "pinning", and more. Filmed at qconsf.com.
Steve Klabnik is on the core team of Rust, leads the documentation team, and is an author of "The Rust Programming Language." He is a frequent speaker at conferences and is a prolific open source contributor, previously working on projects such as Ruby and Ruby on Rails.
2. InfoQ.com: News & Community Site
• Over 1,000,000 software developers, architects and CTOs read the site world-
wide every month
• 250,000 senior developers subscribe to our weekly newsletter
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• 2 dedicated podcast channels: The InfoQ Podcast, with a focus on
Architecture and The Engineering Culture Podcast, with a focus on building
• 96 deep dives on innovative topics packed as downloadable emags and
minibooks
• Over 40 new content items per week
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
rust-async-await/
3. Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Presented at QCon San Francisco
www.qconsf.com
19. A timer future
● Mutex around a boolean
● Spins up a new thread that sleeps for some
amount of time
● When the thread wakes up, it sets the boolean to
true and ‘wakes up’ the future
● Calls to poll check the boolean to see if we’re
done
37. Futures need to have poll() called over and
over until a value is produced
Generators let you call yield over and over to
get values
async/await is a simpler syntax for a
generator that implements the Future trait
57. Before a future starts executing, we need to be able to move it around in memory.
(For example, to create a task out of it, we need to move it to the heap)
Once a future starts executing, it must not move in memory.
(otherwise, borrows in the body of the future would become invalid)
58. When you turn some sort of pointer type into a Pin<P>, you’re promising that what the
pointer to will no longer move.
Box<T> turns into Pin<Box<T>>
There’s an extra trait, “Unpin”, that says “I don’t care about this”, similar to how Copy
says “I don’t care about move semantics.