SyncSplitter
A SyncSplitter allows multiple threads to split a mutable slice at the same time.
It's a bit like a Sync arena, where you can 'allocate' elements in the same
Vec (or some other mutable slice) in parallel, then at the end get back the
elements.
You kinda need this sort of thing to build trees or graphs in parallel (eg. with rayon) without allocating each node individually. The motivating case was a BVH implementation.
Example
use SyncSplitter;
// We'll build a binary tree and store it in an array where each node points to its first,
// child, with the two children always adjacent.
let mut arena = vec!;
let num_nodes = ;
assert_eq!;
arena.truncate;
// `arena` now contains all the nodes in our binary tree.