Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/edda

crates/nornir-graph/tests/fixtures/third_party_sample.rs.fixture

// FIXTURE — NOT COMPILED, NOT SCANNED. Deliberately named `.rs.fixture` rather
// than `.rs` so the guard's own file walk (which collects `*.rs`) cannot pick it
// up. It stands in for a third-party crate that uses rayon perfectly legitimately.
//
// `rayon_free_law.rs` reads this file BY PATH to prove two things at once:
//   * the detector really does fire on rayon usage that is not edda's, and
//   * the first-party scan really does exclude it.
// Together those make "no first-party violations" a scoped measurement rather
// than an unproven claim.
use rayon::prelude::*;

pub fn sum_squares(v: &[u64]) -> u64 {
    v.par_iter().map(|x| x * x).sum()
}

pub fn build_pool(n: usize) -> rayon::ThreadPool {
    rayon::ThreadPoolBuilder::new().num_threads(n).build().unwrap()
}