Trait jobsteal::iter::Split [] [src]

pub trait Split: Sized + Send + IntoIterator {
    fn should_split(&self, mul: f32) -> Option<usize>;
    fn split(self, _: usize) -> (Self, Self);

    fn size_hint(&self) -> (usize, Option<usize>) { ... }
}

Data which can be split in two at an index.

Required Methods

Whether this should split.

This is given a multiplier, which tells you to treat the data as "mul" times as large as it is. The reason for this is that each iterator adapter makes producing an individual item more expensive. As the cost of producing each item goes up, we want to split the data into more parallelizable jobs so we can get better work distribution across threads.

For example, should_split(1.0) for slices returns Some only when then length of the slice is over 4096. This means that should_split(2.0) will return Some when the length of the slice is over 2048.

Split the data at the specified index. Note that this may not always be the same as the index you return from should_split.

Provided Methods

A hint for the size of this data, containing a known lower bound (potentially zero) and an optional upper bound.

Implementors