orx_parallel/parameters/
iteration_order.rs

1/// Order of parallel iteration, which might be:
2/// * in the order of the input as in regular sequential iterators, or
3/// * arbitrary.
4///
5/// This is important for certain computations:
6///
7/// * `collect` will return exactly the same result of its sequential counterpart
8///   when `Ordered` is used. However, the elements might (but not necessarily)
9///   be in arbitrary order when `Arbitrary` is used.
10/// * `first` returns the first element of the iterator when `Ordered`, might
11///   return any element when `Arbitrary`.
12/// * `find` returns the first element satisfying the predicate when `Ordered`,
13///   might return any element satisfying the predicate when `Arbitrary`
14///   (sometimes this method is called `find_any`).
15///
16/// [`collect`]: crate::ParIter::collect
17/// [`first`]: crate::ParIter::first
18/// [`find`]: crate::ParIter::find
19#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
20pub enum IterationOrder {
21    /// The iteration is allowed to be in arbitrary order when it might improve performance,
22    /// but not necessarily.
23    Arbitrary,
24    /// ***Default ordering***.
25    ///
26    /// The iteration will be in an order consistent with the input of the collection,
27    /// and hence, the outputs will always be equivalent to the sequential counterpart.
28    #[default]
29    Ordered,
30}