Re:Rust: “Explain GATs Like I'm 5 Years Old”
by flippinburgers on Tuesday November 08, 2022 @05:22AM
(#33517748)
Is that what this is all about? I feel like the examples people give are nowhere near this simple.
Re:Rust: “Explain GATs Like I'm 5 Years Old”
by stouset on Tuesday November 08, 2022 @10:52AM
(#33520323)
Yep.
People are trying to show how you might use it in practice, which is useful. But I think people should start with the above.
If you’ve ever used associated types, this is the sort of thing you would probably expect would be possible even if you never needed to do it. Now it’s possible.
If you've never needed to write a trait that incorporated an associated type (.AT) which needed to be generic (G..), then this won't mean much to you and that's fine. But you might be using libraries that could be somewhat more ergonomic if they were able to use this feature. The good news is that now that it's been released to stable, a future version of that library can be written more ergonomically.