pub fn par_separate<'a, Brand: ParCompactable, E: 'a + Send, O: 'a + Send>(
fa: <Brand as Kind_cdc7cd43dac7585f>::Of<'a, Result<O, E>>,
) -> (<Brand as Kind_cdc7cd43dac7585f>::Of<'a, E>, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, O>)Expand description
Separates a data structure of Results into two data structures in parallel.
Free function version that dispatches to ParCompactable::par_separate.
§Type Signature
forall Brand E O. ParCompactable Brand => Brand (Result O E) -> (Brand E, Brand O)
§Type Parameters
'a: The lifetime of the elements.Brand: The brand of the compactable structure.E: The type of the error values.O: The type of the success values.
§Parameters
fa: The data structure containingResultvalues.
§Returns
A pair of data structures: the first containing the Err values, and the second containing the Ok values.
§Examples
use fp_library::{
brands::*,
functions::*,
};
let v: Vec<Result<i32, &str>> = vec![Ok(1), Err("e"), Ok(3)];
let (errs, oks): (Vec<&str>, Vec<i32>) = par_separate::<VecBrand, _, _>(v);
assert_eq!(errs, vec!["e"]);
assert_eq!(oks, vec![1, 3]);