Trait CommonRefinementZip

Source
pub trait CommonRefinementZip<B, X, P, V>
where B: Copy + Num + Ord, Self: Iterator<Item = X> + Sized, P: Clone + Interval<B> + for<'b> Intersect<&'b P, Option<P>>,
{ // Required method fn get_interval_value_extractor( &self, ) -> Box<dyn Fn(<Self as Iterator>::Item) -> (P, V)>; // Provided methods fn common_refinement_zip( self, other: Self, ) -> CommonRefinementZipped<B, Self, X, P, V> { ... } fn into_common_refinement_zipped( self, ) -> CommonRefinementZipped<B, Self, X, P, V> { ... } }

Required Methods§

Source

fn get_interval_value_extractor( &self, ) -> Box<dyn Fn(<Self as Iterator>::Item) -> (P, V)>

Provided Methods§

Source

fn common_refinement_zip( self, other: Self, ) -> CommonRefinementZipped<B, Self, X, P, V>

Source

fn into_common_refinement_zipped( self, ) -> CommonRefinementZipped<B, Self, X, P, V>

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.

Implementations on Foreign Types§

Source§

impl<'a, V, B> CommonRefinementZip<B, (&'a ContiguousIntegerSet<B>, &'a V), ContiguousIntegerSet<B>, V> for Iter<'a, IntInterval<B>, V>
where B: 'a + Integer + Copy + ToPrimitive, V: 'a + Clone,

§Example

use math::{
    interval::{traits::Interval, IntInterval},
    iter::CommonRefinementZip,
};
use std::collections::BTreeMap;

let m1: BTreeMap<IntInterval<usize>, i32> =
    vec![(IntInterval::new(0, 5), 5), (IntInterval::new(8, 10), 2)]
        .into_iter()
        .collect();

let m2: BTreeMap<IntInterval<usize>, i32> =
    vec![(IntInterval::new(2, 4), 8), (IntInterval::new(12, 13), 9)]
        .into_iter()
        .collect();

let mut iter = m1.iter().common_refinement_zip(m2.iter());
assert_eq!(
    Some((IntInterval::new(0, 1), vec![Some(5), None])),
    iter.next()
);
assert_eq!(
    Some((IntInterval::new(2, 4), vec![Some(5), Some(8)])),
    iter.next()
);
assert_eq!(
    Some((IntInterval::new(5, 5), vec![Some(5), None])),
    iter.next()
);
assert_eq!(
    Some((IntInterval::new(8, 10), vec![Some(2), None])),
    iter.next()
);
assert_eq!(
    Some((IntInterval::new(12, 13), vec![None, Some(9)])),
    iter.next()
);
assert_eq!(None, iter.next());
Source§

fn get_interval_value_extractor( &self, ) -> Box<dyn Fn(<Self as Iterator>::Item) -> (IntInterval<B>, V)>

Source§

impl<'a, V, B> CommonRefinementZip<B, (ContiguousIntegerSet<B>, V), ContiguousIntegerSet<B>, V> for IntoIter<IntInterval<B>, V>
where B: 'a + Integer + Copy + ToPrimitive,

Source§

fn get_interval_value_extractor( &self, ) -> Box<dyn Fn(<Self as Iterator>::Item) -> (IntInterval<B>, V)>

Implementors§