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, Unsafe

This section (Async): 34: What is async?, 35: Futures, 36: async/await, 37: Runtimes, 38: Exercise E1a, 39: Exercise E1b, 40: Exercise E2a, 41: Exercise E2b

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, Unsafe

This section (Async): 34: What is async?, 35: Futures, 36: async/await, 37: Runtimes, 38: Exercise E1a, 39: Exercise E1b, 40: Exercise E2a, 41: Exercise E2b

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, Unsafe

This section (Async): 34: What is async?, 35: Futures, 36: async/await, 37: Runtimes, 38: Exercise E1a, 39: Exercise E1b, 40: Exercise E2a, 41: Exercise E2b

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, Unsafe

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.

Elected to the Matrix Foundation Governing Board!

I am really excited to say I was elected to the Governing Board of the Matrix Foundation!

I was really surprised because there were lots of people standing, and the quality of the candidates was very high, but I am one of the lucky ones. I hope I can do a decent job of helping the foundation find its feet and bring about the change we want in modern communications. Thank you to everyone who voted for me: I will do my best.

As I wrote back in 2021, Matrix is our best bet to free ourselves from proprietary silos and realise the potential of private, secure communications between individuals and organisations across the world.

You can read my previous post to see the platform I ran on: Standing for the Matrix Governing Board.

Since I wrote that there has been some very healthy discussion of the need for diversity in the Matrix community, and having been involved in diversity advocacy in several workplaces I am really keen to do what I can on this in the Matrix world. As an open standard we have a number of key advantages over other platforms that can make our software and our community beneficial for a wide variety of people.

Reasons why Matrix can be better for diversity than closed platforms

  • Wide variety of implementations – since Matrix clients can be implemented by anyone, communities can have control over their software to make it work for them. This means specialised clients for people with different needs, and it also means experts can contribute to general clients to make them work better for more people. Our openness makes us stronger.
  • Public accountability – as a community working for everyone’s benefit, we are accountable to everyone for our behaviour. One of the jobs of the governing board will be to make sure marginalised voices are heard. Our openness makes us stronger!
  • Low cost – as an open source project there should be no financial barriers to entry for anyone wanting to use Matrix or contribute to it. Although lots of companies are building Matrix and building on Matrix for profit, one of the jobs of the foundation (as I see it) is to make sure we act as a truly open project, benefiting from the perspectives of people whose voices are silenced in high-cost ecosystems. Our openness makes us stronger!

Additionally, because several governments fund and use Matrix, they often have strong provisions around accessibility: this can help hold all implementers to high standards.

However, we have a number of significant problems.

Areas where Matrix is lacking

  • Low diversity of contributors – along with much of the open source community, Matrix is missing lots of people from its community. Many contributors, like me, have highly privileged backgrounds making it difficult or impossible to serve the needs of under-represented people. Unless we make space and opportunities for people who have been marginalised to take the lead, we will fail, over and over, to fulfil our ambition to be a universal platform.
  • Safety and inappropriate content – many public Matrix servers are accidentally hosting illegal, offensive and inappropriate content, and are not always safe places for people of all ages to be. Although safety teams are working hard (for too little thanks!) every day to deal with this, the tooling for working in this area is sorely lacking, making the work much harder than it should be, and the teams are too small.
  • Lack of funds – the foundation and the companies working on Matrix do not have enough money to deal with the above problems. We need more funding from donations, corporations and governments to pay for work on diverse contributions, safety tooling, and safety staffing. So please donate to the foundation and persuade your organisation to fund Matrix. How about paying for an Outreachy internship as Element did in 2022?

Please do comment below or contact me on Matrix (directly on @andybalaam:matrix.org or in a public room e.g. #foundation-office:matrix.org) if you’d like to discuss this more!