pub fn merge_sparse_indices<I: Ord, T: Eq, U>(
left: impl Iterator<Item = (I, T)>,
right: impl Iterator<Item = (I, T)>,
operation: impl Fn(T, T) -> U,
operation_left: impl Fn(T) -> U,
operation_right: impl Fn(T) -> U,
is_not_default: impl Fn(&U) -> bool,
) -> Vec<(I, U)>Expand description
Collect two sparse iterators by merging them.
§Arguments
left: The first iterator, sorted by index.right: The second iterator, sorted by index.operation: A binary operation applied when an element is found at some index in both iterators.operation_left: A unitary operation applied when an element is found only in the left iterator.operation_right: A unitary operation applied when an element is found only in the right iterator.is_not_default: A function specifying whether the result if the binary operation is the default value (that is often zero).
§Return value
A vector with sparse elements by sorted and unique index.