pub trait CollectionMapReduce: ViewSchema{
// Required method
fn map<'doc>(
&self,
document: CollectionDocument<<Self::View as View>::Collection>,
) -> ViewMapResult<'doc, Self>
where CollectionDocument<<Self::View as View>::Collection>: 'doc;
// Provided method
fn reduce(
&self,
mappings: &[ViewMappedValue<'_, Self>],
rereduce: bool,
) -> ReduceResult<Self::View> { ... }
}Expand description
A MapReduce implementation that automatically serializes/deserializes
using CollectionDocument and SerializedCollection.
Implementing this trait automatically implements ViewSchema for the same
type.
Required Methods§
Sourcefn map<'doc>(
&self,
document: CollectionDocument<<Self::View as View>::Collection>,
) -> ViewMapResult<'doc, Self>
fn map<'doc>( &self, document: CollectionDocument<<Self::View as View>::Collection>, ) -> ViewMapResult<'doc, Self>
The map function for this view. This function is responsible for emitting entries for any documents that should be contained in this View. If None is returned, the View will not include the document.
Provided Methods§
Sourcefn reduce(
&self,
mappings: &[ViewMappedValue<'_, Self>],
rereduce: bool,
) -> ReduceResult<Self::View>
fn reduce( &self, mappings: &[ViewMappedValue<'_, Self>], rereduce: bool, ) -> ReduceResult<Self::View>
The reduce function for this view. If Err(Error::ReduceUnimplemented)
is returned, queries that ask for a reduce operation will return an
error. See CouchDB’s Reduce/Rereduce
documentation
for the design this implementation will be inspired by
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.