Rust 101 – 36: What async and await really do

Attempting to explain as slowly as possible what actually happens when the compiler finds an async function containing awaits: it writes a poll method for you to create something that implements Future. The generated poll method polls the Futures you asked to await, in order. The interesting bit is that this generated thing that implements Future and has a poll method needs to own the things it refers to, which is what leads to some of the most confusing error messages you see when writing this kind of code.

Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async

This section (Async): 34: What is async?, 35: Futures, 36: async/await

Links:

The course materials for this series are developed by tweede golf. You can find more information at github.com/tweedegolf/101-rs and you can sponsor the work at github.com/sponsors/tweedegolf. They are released under the Creative Commons Attribution Share Alike 4.0 International license.

This series of videos is copyright 2024 Andy Balaam and the tweede golf contributors and is released under the Creative Commons Attribution Share Alike 4.0 International license.

Rust 101 – 35: Futures

Exploring what a Future is in async Rust and how we could manually write code that polls futures. Normally, we avoid this manual work by using the `async` and `await` keywords, but looking into this helps us understand what those keywords really do.

Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async

This section (Async): 34: What is async?, 35: Futures, 36: async/await

Links:

The course materials for this series are developed by tweede golf. You can find more information at github.com/tweedegolf/101-rs and you can sponsor the work at github.com/sponsors/tweedegolf. They are released under the Creative Commons Attribution Share Alike 4.0 International license.

This series of videos is copyright 2024 Andy Balaam and the tweede golf contributors and is released under the Creative Commons Attribution Share Alike 4.0 International license.

Rust 101 – 34: What is async?

What async programming is and what it looks like in Rust.

Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async

This section (Async): 34: What is async?, 35: Futures, 36: async/await

Links:

The course materials for this series are developed by tweede golf. You can find more information at github.com/tweedegolf/101-rs and you can sponsor the work at github.com/sponsors/tweedegolf. They are released under the Creative Commons Attribution Share Alike 4.0 International license.

This series of videos is copyright 2024 Andy Balaam and the tweede golf contributors and is released under the Creative Commons Attribution Share Alike 4.0 International license.

Rust 101 – 33: Exercises for module D (q3)

Following through an exercise using a trait object with dynamic dispatch to choose different behaviour at runtime.

Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async

This section (Trait objects): 28: Dynamic dispatch, 29: Object safety, 30: Patterns, 31: Exercise D1, 32: Exercise D2, 33: Exercise D3

Links:

The course materials for this series are developed by tweede golf. You can find more information at github.com/tweedegolf/101-rs and you can sponsor the work at github.com/sponsors/tweedegolf. They are released under the Creative Commons Attribution Share Alike 4.0 International license.

This series of videos is copyright 2024 Andy Balaam and the tweede golf contributors and is released under the Creative Commons Attribution Share Alike 4.0 International license.

Rust 101 – 32: Exercises for module D (q2)

Trying out the typestate pattern by tracking the state of a 3D printer by changing our type instead of updating a variable whenever it changes.

Series: Language basics, More syntax, Traits and generics, Building applications, Concurrency and parallelism, Trait objects, Async

This section (Trait objects): 28: Dynamic dispatch, 29: Object safety, 30: Patterns, 31: Exercise D1, 32: Exercise D2, 33: Exercise D3

Links:

The course materials for this series are developed by tweede golf. You can find more information at github.com/tweedegolf/101-rs and you can sponsor the work at github.com/sponsors/tweedegolf. They are released under the Creative Commons Attribution Share Alike 4.0 International license.

This series of videos is copyright 2024 Andy Balaam and the tweede golf contributors and is released under the Creative Commons Attribution Share Alike 4.0 International license.