1#![allow(dead_code)]
2#![allow(clippy::module_name_repetitions, clippy::shadow_unrelated)]
3
4use rayon::ThreadPoolBuilder;
5use std::env;
6
7pub mod eq;
8pub mod parse;
9
10/// Read the `ABORT_AFTER_FAILURE` environment variable, and parse it.
11pub fn abort_after() -> usize {
12 match env::var("ABORT_AFTER_FAILURE") {
13 Ok(s) => s.parse().expect("failed to parse ABORT_AFTER_FAILURE"),
14 Err(_) => usize::max_value(),
15 }
16}
17
18/// Configure Rayon threadpool.
19pub fn rayon_init() {
20 let stack_size = match env::var("RUST_MIN_STACK") {
21 Ok(s) => s.parse().expect("failed to parse RUST_MIN_STACK"),
22 Err(_) => 20 * 1024 * 1024,
23 };
24 ThreadPoolBuilder::new()
25 .stack_size(stack_size)
26 .build_global()
27 .unwrap();
28}
29