tree-buf 0.10.0

A prototype binary serialization protocol for data
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::prelude::*;
use rayon;

// TODO: Have a way to not use rayon when the operation is considered 'trivial'
#[inline(always)]
pub fn parallel<A: Send, B: Send>(a: impl FnOnce() -> A + Send, b: impl FnOnce() -> B + Send, options: &impl DecodeOptions) -> (A, B) {
    if options.parallel() {
        rayon::join(a, b)
    } else {
        (a(), b())
    }
}