Skip to content

Instantly share code, notes, and snippets.

@matklad matklad/ Secret
Last active Oct 24, 2019

What would you like to do?
enum Option<T> { Some(T), None }
fn try_reduce_with<PI, R, T>(pi: PI, reduce_op: R) -> Option<T>
PI: ParallelIterator<Item = T>,
R: Fn(T::Ok, T::Ok) -> T + Sync,
T: Try + Send,
let full = AtomicBool::new(false);
let consumer = TryReduceWithConsumer {
reduce_op: &reduce_op,
full: &full,
struct TryReduceWithConsumer<'r, R: 'r> {
reduce_op: &'r R,
full: &'r AtomicBool,
pub trait ParallelIterator: Sized + Send {
type Item: Send;
fn drive_unindexed<C>(self, consumer: C) -> C::Result
C: UnindexedConsumer<Self::Item>;
pub trait Try {
type Ok;
type Error;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.