Trait IntoConcurrentIter

Source
pub trait IntoConcurrentIter {
    type Item: Send + Sync;
    type IntoIter: ConcurrentIter<Item = Self::Item>;

    // Required method
    fn into_con_iter(self) -> Self::IntoIter;
}
Expand description

Trait to convert a source (collection or generator) into a concurrent iterator; i.e., ConcurrentIter, using its into_con_iter method.

It can be considered as the concurrent counterpart of the IntoIterator trait.

§Examples

use orx_concurrent_iter::*;

let vec = vec![1, 2];
let con_iter = vec.into_con_iter();
assert_eq!(con_iter.next(), Some(1));
assert_eq!(con_iter.next(), Some(2));
assert_eq!(con_iter.next(), None);

let range = 11..13;
let con_iter = range.into_con_iter();
assert_eq!(con_iter.next(), Some(11));
assert_eq!(con_iter.next(), Some(12));
assert_eq!(con_iter.next(), None);

Required Associated Types§

Source

type Item: Send + Sync

Type of the element that the concurrent iterator yields.

Source

type IntoIter: ConcurrentIter<Item = Self::Item>

Type of the concurrent iterator that this type can be converted into.

Required Methods§

Source

fn into_con_iter(self) -> Self::IntoIter

Trait to convert a source (collection or generator) into a concurrent iterator; i.e., ConcurrentIter, using its into_con_iter method.

It can be considered as the concurrent counterpart of the IntoIterator trait.

§Examples
use orx_concurrent_iter::*;

let vec = vec![1, 2];
let con_iter = vec.into_con_iter();
assert_eq!(con_iter.next(), Some(1));
assert_eq!(con_iter.next(), Some(2));
assert_eq!(con_iter.next(), None);

let range = 11..13;
let con_iter = range.into_con_iter();
assert_eq!(con_iter.next(), Some(11));
assert_eq!(con_iter.next(), Some(12));
assert_eq!(con_iter.next(), None);

Implementations on Foreign Types§

Source§

impl<'a, T> IntoConcurrentIter for &'a [T]
where T: Send + Sync,

Source§

impl<'a, T> IntoConcurrentIter for &'a VecDeque<T>
where T: Send + Sync,

Source§

impl<'a, T> IntoConcurrentIter for &'a Vec<T>
where T: Send + Sync,

Source§

impl<T> IntoConcurrentIter for VecDeque<T>
where T: Send + Sync,

Source§

impl<T> IntoConcurrentIter for Vec<T>
where T: Send + Sync,

Source§

impl<T> IntoConcurrentIter for Range<T>
where T: Send + Sync + From<usize> + Into<usize>, Range<T>: Default + Clone + ExactSizeIterator<Item = T>,

Implementors§

Source§

impl<'a, T, S, X> IntoConcurrentIter for RawJaggedRef<'a, T, S, X>
where T: Send + Sync + 'a, X: JaggedIndexer, S: Slices<'a, T> + Send + Sync,

Source§

impl<T> IntoConcurrentIter for ConIterRange<T>
where T: Send + Sync + From<usize> + Into<usize>, Range<T>: Default + Clone + ExactSizeIterator<Item = T>,

Source§

impl<T, X> IntoConcurrentIter for RawJagged<T, X>
where T: Send + Sync, X: JaggedIndexer,