1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use crate::ConcurrentIter;

/// A type that can be consumed and turned into a concurrent iterator with `into_con_iter` method.
pub trait IntoConcurrentIter {
    /// Type of the items that the iterator yields.
    type Item;

    /// Concurrent iterator that this type will be converted into with the `into_con_iter` method.
    type ConIter: ConcurrentIter<Item = Self::Item>;

    /// Consumes this type and converts it into a concurrent iterator.
    fn into_con_iter(self) -> Self::ConIter;
}

/// An Iterator type that can be consumed and turned into a concurrent iterator with `into_con_iter` method.
pub trait IterIntoConcurrentIter {
    /// Type of the items that the iterator yields.
    type Item;

    /// Concurrent iterator that this type will be converted into with the `into_con_iter` method.
    type ConIter: ConcurrentIter<Item = Self::Item>;

    /// Consumes this type and converts it into a concurrent iterator.
    fn into_con_iter(self) -> Self::ConIter;
}