This PR aims at reducing the complexity introduced in #284. By moving map/reduce to their own trait, it made it easier to provide a derive macro for ViewSchema.
The derive macro is able to substitute in the correct values when no lifetimes are involved, and when the 'doc associated lifetime is used, everything just works as intended.
This also has another nice side effect of simplifying where the magic happens for CollectionDocument-based map/reduce. Now all the shared ViewSchema functionality lives on the shared trait, and CollectionMapReduce is a simplified version of MapReduce when working with SerializedCollections.
Tasks remaining:
[x] Add UI tests for the new macro
[x] Add derive documentation to ViewSchema docs.
[x] Document breaking changes.
Most code will be able to be easily updated. For example, here's the "before"UniqueView definition from core::test_util:
This also brings us a little closer to allowing CollectionDocument to use borrowed data, but that will be a bit more of an involved change, maybe involving updates to transmog.
This PR aims at reducing the complexity introduced in #284. By moving map/reduce to their own trait, it made it easier to provide a derive macro for ViewSchema.
The derive macro is able to substitute in the correct values when no lifetimes are involved, and when the 'doc associated lifetime is used, everything just works as intended.
This also has another nice side effect of simplifying where the magic happens for CollectionDocument-based map/reduce. Now all the shared ViewSchema functionality lives on the shared trait, and CollectionMapReduce is a simplified version of MapReduce when working with SerializedCollections.
Tasks remaining:
ViewSchema
docs.Most code will be able to be easily updated. For example, here's the "before"
UniqueView
definition fromcore::test_util
:And the updated changes:
This also brings us a little closer to allowing CollectionDocument to use borrowed data, but that will be a bit more of an involved change, maybe involving updates to
transmog
.