Find Related products on Amazon

Shop on Amazon

Async from scratch 3: Pinned against the wall

Published on: 2025-06-25 14:02:00

So, we've covered polling. We've tackled sleeping (and waking). Going back to the definition, that leaves us with one core concept left to conquer: pinning! But before we get there, there was that one tiny other aside I'd like to go over, just so we can actually use the real trait this time. It'll be quick, I promise. And then we'll be back to what you came here for. Intermission: Letting our types associate Let's ignore poll() completely for a second, and focus on another sneaky change I pulled between Future and SimpleFuture : trait Future { type Output ; } trait SimpleFuture {} What's the difference between these? Future::Output is an "associated type". Associated types are very similar to trait generics, but they aren't used to pick the right trait implementation. The way I tend to think of this is that if we think of our type as a kind-of-a-function, then generics would be the arguments, while its associated types would be the return value(s). We can define our trai ... Read full article.