use crate::{base, common::*, config::IntoParStreamParams, impls};
pub trait TryParStreamExt {
fn try_par_then<T, F, Fut>(
self,
config: impl IntoParStreamParams,
f: F,
) -> TryParMap<T, Self::Error>
where
T: 'static + Send,
F: 'static + FnMut(Self::Ok) -> Fut + Send,
Fut: 'static + Future<Output = Result<T, Self::Error>> + Send,
Self: 'static + TryStreamExt + Sized + Unpin + Send,
Self::Ok: Send,
Self::Error: Send,
{
impls::try_stream::TryParStreamExt::try_par_then(self, config, f)
}
fn try_par_then_init<T, B, InitF, MapF, Fut>(
self,
config: impl IntoParStreamParams,
init_f: InitF,
map_f: MapF,
) -> TryParMap<T, Self::Error>
where
T: 'static + Send,
B: 'static + Send + Clone,
InitF: FnMut() -> B,
MapF: 'static + FnMut(B, Self::Ok) -> Fut + Send,
Fut: 'static + Future<Output = Result<T, Self::Error>> + Send,
Self: 'static + TryStreamExt + Sized + Unpin + Send,
Self::Ok: Send,
Self::Error: Send,
{
impls::try_stream::TryParStreamExt::try_par_then_init(self, config, init_f, map_f)
}
fn try_par_then_unordered<T, F, Fut>(
self,
config: impl IntoParStreamParams,
f: F,
) -> TryParMapUnordered<T, Self::Error>
where
T: 'static + Send,
F: 'static + FnMut(Self::Ok) -> Fut + Send,
Fut: 'static + Future<Output = Result<T, Self::Error>> + Send,
Self: 'static + TryStreamExt + Sized + Unpin + Send,
Self::Ok: Send,
Self::Error: Send,
{
impls::try_stream::TryParStreamExt::try_par_then_unordered(self, config, f)
}
fn try_par_then_init_unordered<T, B, InitF, MapF, Fut>(
self,
config: impl IntoParStreamParams,
init_f: InitF,
map_f: MapF,
) -> TryParMapUnordered<T, Self::Error>
where
T: 'static + Send,
B: 'static + Send + Clone,
InitF: FnMut() -> B,
MapF: 'static + FnMut(B, Self::Ok) -> Fut + Send,
Fut: 'static + Future<Output = Result<T, Self::Error>> + Send,
Self: 'static + TryStreamExt + Sized + Unpin + Send,
Self::Ok: Send,
Self::Error: Send,
{
impls::try_stream::TryParStreamExt::try_par_then_init_unordered(self, config, init_f, map_f)
}
fn try_par_map<T, F, Func>(
self,
config: impl IntoParStreamParams,
f: F,
) -> TryParMap<T, Self::Error>
where
T: 'static + Send,
F: 'static + FnMut(Self::Ok) -> Func + Send,
Func: 'static + FnOnce() -> Result<T, Self::Error> + Send,
Self: 'static + TryStreamExt + Sized + Unpin + Send,
Self::Ok: Send,
Self::Error: Send,
{
impls::try_stream::TryParStreamExt::try_par_map(self, config, f)
}
fn try_par_map_init<T, B, InitF, MapF, Func>(
self,
config: impl IntoParStreamParams,
init_f: InitF,
map_f: MapF,
) -> TryParMap<T, Self::Error>
where
T: 'static + Send,
B: 'static + Send + Clone,
InitF: FnMut() -> B,
MapF: 'static + FnMut(B, Self::Ok) -> Func + Send,
Func: 'static + FnOnce() -> Result<T, Self::Error> + Send,
Self: 'static + TryStreamExt + Sized + Unpin + Send,
Self::Ok: Send,
Self::Error: Send,
{
impls::try_stream::TryParStreamExt::try_par_map_init(self, config, init_f, map_f)
}
fn try_par_map_unordered<T, F, Func>(
self,
config: impl IntoParStreamParams,
f: F,
) -> TryParMapUnordered<T, Self::Error>
where
T: 'static + Send,
F: 'static + FnMut(Self::Ok) -> Func + Send,
Func: 'static + FnOnce() -> Result<T, Self::Error> + Send,
Self: 'static + TryStreamExt + Sized + Unpin + Send,
Self::Ok: Send,
Self::Error: Send,
{
impls::try_stream::TryParStreamExt::try_par_map_unordered(self, config, f)
}
fn try_par_map_init_unordered<T, B, InitF, MapF, Func>(
self,
config: impl IntoParStreamParams,
init_f: InitF,
map_f: MapF,
) -> TryParMapUnordered<T, Self::Error>
where
T: 'static + Send,
B: 'static + Send + Clone,
InitF: FnMut() -> B,
MapF: 'static + FnMut(B, Self::Ok) -> Func + Send,
Func: 'static + FnOnce() -> Result<T, Self::Error> + Send,
Self: 'static + TryStreamExt + Sized + Unpin + Send,
Self::Ok: Send,
Self::Error: Send,
{
impls::try_stream::TryParStreamExt::try_par_map_init_unordered(self, config, init_f, map_f)
}
fn try_wrapping_enumerate<T, E>(self) -> TryWrappingEnumerate<T, E, Self>
where
Self: Stream<Item = Result<T, E>> + Sized + Unpin + Send,
{
base::TryParStreamExt::try_wrapping_enumerate(self)
}
fn try_reorder_enumerated<T, E>(self) -> TryReorderEnumerated<T, E, Self>
where
Self: Stream<Item = Result<(usize, T), E>> + Sized + Unpin + Send,
{
base::TryParStreamExt::try_reorder_enumerated(self)
}
fn try_par_for_each<F, Fut>(
self,
config: impl IntoParStreamParams,
f: F,
) -> TryParForEach<Self::Error>
where
F: 'static + FnMut(Self::Ok) -> Fut + Send,
Fut: 'static + Future<Output = Result<(), Self::Error>> + Send,
Self: 'static + TryStreamExt + Sized + Unpin + Send,
Self::Ok: Send,
Self::Error: Send,
{
impls::try_stream::TryParStreamExt::try_par_for_each(self, config, f)
}
fn try_par_for_each_init<B, InitF, MapF, Fut>(
self,
config: impl IntoParStreamParams,
init_f: InitF,
map_f: MapF,
) -> TryParForEach<Self::Error>
where
Self: 'static + TryStreamExt + Sized + Unpin + Send,
Self::Ok: Send,
Self::Error: Send,
B: 'static + Send + Clone,
InitF: FnMut() -> B,
MapF: 'static + FnMut(B, Self::Ok) -> Fut + Send,
Fut: 'static + Future<Output = Result<(), Self::Error>> + Send,
{
impls::try_stream::TryParStreamExt::try_par_for_each_init(self, config, init_f, map_f)
}
fn try_par_for_each_blocking<F, Func>(
self,
config: impl IntoParStreamParams,
f: F,
) -> TryParForEach<Self::Error>
where
Self: 'static + TryStreamExt + Sized + Unpin + Send,
Self::Ok: Send,
Self::Error: Send,
F: 'static + FnMut(Self::Ok) -> Func + Send,
Func: 'static + FnOnce() -> Result<(), Self::Error> + Send,
{
impls::try_stream::TryParStreamExt::try_par_for_each_blocking(self, config, f)
}
fn try_par_for_each_blocking_init<B, InitF, MapF, Func>(
self,
config: impl IntoParStreamParams,
init_f: InitF,
f: MapF,
) -> TryParForEach<Self::Error>
where
Self: 'static + TryStreamExt + Sized + Unpin + Send,
Self::Ok: Send,
Self::Error: Send,
B: 'static + Send + Clone,
InitF: FnMut() -> B,
MapF: 'static + FnMut(B, Self::Ok) -> Func + Send,
Func: 'static + FnOnce() -> Result<(), Self::Error> + Send,
{
impls::try_stream::TryParStreamExt::try_par_for_each_blocking_init(self, config, init_f, f)
}
}
impl<S> TryParStreamExt for S where S: TryStream {}
pub use impls::try_stream::TryParMap;
pub use impls::try_stream::TryParMapUnordered;
pub use impls::try_stream::TryParForEach;
pub use base::TryWrappingEnumerate;
pub use base::TryReorderEnumerated;