orx-parallel 4.0.0

Performant parallel computations with an expressive iterator API.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use alloc::string::{String, ToString};
use alloc::vec;
use alloc::vec::Vec;

pub fn inputs_res(n: usize, error_idx: Option<usize>) -> Vec<Result<String, Vec<char>>> {
    let error_idx = error_idx.unwrap_or(usize::MAX);
    (0..n)
        .map(|i| match i == error_idx {
            true => Err(vec!['a']),
            false => Ok(i.to_string()),
        })
        .collect()
}

pub fn inputs(n: usize) -> Vec<String> {
    (0..n).map(|i| i.to_string()).collect()
}