This PR introduces support for Generic Associated Types for arrangement Key and Val 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, like String. 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 associated KeyOwned and ValOwned type; these are lifetime-less types that each of the lifetimed traits can be converted into. There is a helpful trait MyTrait (better name pending) which describes something like a generalization of ToOwned, without requiring a Borrow 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 write type Val<'a> = &'a T, then T will need to be outlive all of the Val<'a> up to and including Val<'static>.
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>
.