Add projection functions to Yoke #829
Labels
A-design
Area: Architecture or design
C-data-infra
Component: provider, datagen, fallback, adapters
S-medium
Size: Less than a week (larger bug fix or enhancement)
T-core
Type: Required functionality
There are several use cases where we need to project a Yoke from one Yokeable type to another Yokeable type but keeping the same Cart; i.e., map
Yoke<A, C>
toYoke<B, C>
.A few examples of use cases:
Yoke<ZeroMap<'static, Foo, Bar>, C>
toYoke<Bar, C>
(getting a value from a map)Yoke<&'static [u8], C>
toYoke<T, C>
(applying a deserializer to a slice)Yoke<T, C>
toYoke<Q, C>
whereQ
is a field ofT
(selecting more specific data)I can envision these operations being chained and performed by different data providers. For example, the single-file data provider can return
DataPayload<BytesMarker>
, which a deserialization provider converts to aDataPayload<LargerDataStructMarker>
, which a data filtering provider converts to aDataPayload<SmallerDataStructMarker>
.CC @Manishearth
The text was updated successfully, but these errors were encountered: