pub trait MapReducer {
type Label: Clone;
type Error;
// Required methods
fn map(&mut self, node: NodeId) -> Result<Option<Self::Label>, Self::Error>;
fn reduce<'a, I: Iterator<Item = &'a Self::Label>>(
&mut self,
first_label: Self::Label,
other_labels: I,
) -> Result<Option<Self::Label>, Self::Error>
where Self::Label: 'a;
// Provided methods
fn map_reduce(
&mut self,
node: NodeId,
successors_label: Self::Label,
) -> Result<Option<Self::Label>, Self::Error> { ... }
fn on_node_traversed(
&mut self,
_node: NodeId,
_label: Option<&Self::Label>,
) -> Result<(), Self::Error> { ... }
}Expand description
Callbacks for MapReduce
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn map_reduce(
&mut self,
node: NodeId,
successors_label: Self::Label,
) -> Result<Option<Self::Label>, Self::Error>
fn map_reduce( &mut self, node: NodeId, successors_label: Self::Label, ) -> Result<Option<Self::Label>, Self::Error>
Special-case of Self::reduce for merging a node’s label with its successors’ label
Defaults to calling Self::reduce.
Not guaranteed to be called for every node.
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.