use crate::extendable::ParExtendCore;
use crate::{Par, ParOption, ParResult};
pub trait ParExtend<T>: ParExtendCore<T> {
fn par_extend(&mut self, iter: impl Par<Item = T>)
where
T: Send;
fn par_extend_optional(&mut self, iter: impl ParOption<Elem = T>) -> Option<()>
where
T: Send;
fn par_extend_fallible<I>(&mut self, iter: I) -> Result<(), I::Error>
where
I: ParResult<Elem = T>,
I::Error: Send,
T: Send;
}
impl<T, P: ParExtendCore<T>> ParExtend<T> for P {
fn par_extend(&mut self, iter: impl Par<Item = T>)
where
T: Send,
{
iter.collect_into(self);
}
fn par_extend_optional(&mut self, iter: impl ParOption<Elem = T>) -> Option<()>
where
T: Send,
{
iter.collect_into(self)
}
fn par_extend_fallible<I>(&mut self, iter: I) -> Result<(), I::Error>
where
I: ParResult<Elem = T>,
I::Error: Send,
T: Send,
{
iter.collect_into(self)
}
}