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§
Sourcetype IntoIter: ConcurrentIter<Item = Self::Item>
type IntoIter: ConcurrentIter<Item = Self::Item>
Type of the concurrent iterator that this type can be converted into.
Required Methods§
Sourcefn into_con_iter(self) -> Self::IntoIter
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);