beekeeper 0.3.0

A full-featured worker pool library for parallelizing tasks
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// Trait implemented by a `Box`ed callable that can be executed once.
pub trait BoxedFnOnce {
    /// The type returned by the callable when called.
    type Output;

    /// Calls the boxed callable and returns the result.
    fn call_box(self: Box<Self>) -> Self::Output;
}

/// Blanket implementation of `BoxedFnOnce` for `FnOnce`.
impl<T, F: FnOnce() -> T> BoxedFnOnce for F {
    type Output = T;

    #[inline]
    fn call_box(self: Box<F>) -> Self::Output {
        (*self)()
    }
}