Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
Here's some history of the GATS, from the original author of the RFC and how their sole purpose is to not have to add HKTS.
https://github.com/rust-lang/rust/pull/96709#issuecomment-11...
Well you don't have to use it just because it is added, but it will allow library writers to provide more ergonomic interfaces. This specific type system feature allows for stuff that weren't possible before but make sense and you'd expect to be valid code that compiles:
the most common example is the lending iterator. Have a struct that owns a vector of data. Can you implement an iterator that can return a reference of each item when you call next()? Not without GATs, because each time you return from next() you're creating a new lifetime that doesn't exist in your trait definition.
That's why current standard library iterators are basically structs that own a reference to what you iterate. See the GAT RFC which explains this concept much better than I can:
https://github.com/rust-lang/rfcs/blob/master/text/1598-gene...
TL;DR it's not a "new" feature per se but something that could have been present from the beginning without making the language different.