fn run<'a>(
            scope: &rayon::Scope<'a>,
            f: &'a (impl Fn(u32, i32) -> std::ops::Range<i32> + Sync + 'a),
            max_s: u32,
            max_t: &'a (impl Fn(u32) -> i32 + Sync + 'a),
            s: u32,
            t: i32,
        ) {
            let mut ret = f(s, t);
            if s + 1 < max_s {
                ret.start += 1;
                ret.end = std::cmp::min(ret.end + 1, max_t(s + 1));

                if !ret.is_empty() {
                    // We spawn a new scope to avoid recursion, which may blow the stack
                    scope.spawn(move |scope| {
                        ret.into_par_iter()
                            .for_each(|t| run(scope, f, max_s, max_t, s + 1, t));
                    });
                }
            }
        }
// Rust does not support recursive closures, so we have to pass everything along as
// arguments.
Rust does not support recursive closures, so we have to pass everything along as
arguments.
Rust does not support recursive closures so we have to pass everything along as arguments .
fn run<'a>(
            scope: &rayon::Scope<'a>,
            f: &'a (impl Fn(u32, i32) -> std::ops::Range<i32> + Sync + 'a),
            max_s: u32,
            max_t: &'a (impl Fn(u32) -> i32 + Sync + 'a),
            s: u32,
            t: i32,
        ) {
            let mut ret = f(s, t);
            if s + 1 < max_s {
                ret.start += 1;
                ret.end = std::cmp::min(ret.end + 1, max_t(s + 1));
                if !ret.is_empty() {
                    // We spawn a new scope to avoid recursion, which may blow the stack
                    scope.spawn(move |scope| {
                        ret.into_par_iter()
                            .for_each(|t| run(scope, f, max_s, max_t, s + 1, t));
                    });
                }
            }
        }
fn run < ' a > ( scope : & rayon :: Scope < ' a > , f : & ' a ( impl Fn ( u32 , i32 ) -> std :: ops :: Range < i32 > + Sync + ' a ) , max_s : u32 , max_t : & ' a ( impl Fn ( u32 ) -> i32 + Sync + ' a ) , s : u32 , t : i32 , ) { let mut ret = f ( s , t ) ; if s + 1 < max_s { ret . start += 1 ; ret . end = std :: cmp :: min ( ret . end + 1 , max_t ( s + 1 ) ) ; if ! ret . is_empty ( ) { // We spawn a new scope to avoid recursion, which may blow the stack scope . spawn ( move | scope | { ret . into_par_iter ( ) . for_each ( | t | run ( scope , f , max_s , max_t , s + 1 , t ) ) ; } ) ; } } }
Rust does not support recursive closures, so we have to pass everything along as
arguments.
Rust does not support recursive closures so we have to pass everything along as arguments .
scope
&rayon::Scope<'a>
f
&'a (impl Fn(u32, i32) -> std::ops::Range<i32> + Sync + 'a)
max_s
u32
max_t
&'a (impl Fn(u32) -> i32 + Sync + 'a)
s
u32
t
i32
scope
&rayon::Scope<'a>
f
&'a (impl Fn(u32, i32) -> std::ops::Range<i32> + Sync + 'a)
max_s
u32
max_t
&'a (impl Fn(u32) -> i32 + Sync + 'a)
s
u32
t
i32