Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces support for Generic Associated Types for arrangement
Key
andVal
associated types. The types are generic in a lifetime'storage
that corresponds to the shared read-only storage from which they are read. Conventionally these types would be&'a Key
and&'a Val
for some standard key and value types, likeString
. By allowing them to vary with lifetimes, we can introduce new types that serve a smart pointers to the corresponding content. This allows for example encoded data returned with a shared codebook, or returning pairs of references rather than a reference to a pair (allowing more columnar support).The changes are pervasive, but everywhere the theme is that
::Key
turns to::Key<'a>
and::Val
turns to::Val<'a>
. More traits also now have an associatedKeyOwned
andValOwned
type; these are lifetime-less types that each of the lifetimed traits can be converted into. There is a helpful traitMyTrait
(better name pending) which describes something like a generalization ofToOwned
, without requiring aBorrow
implementation, and some convenience methods.The only "harm" I've found so far is that lifetime GATs can force some
'static
bound introductions where they didn't exist before. These are e.g. when you writetype Val<'a> = &'a T
, thenT
will need to be outlive all of theVal<'a>
up to and includingVal<'static>
.