1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20

use futures_cpupool::CpuPool;

/// A Shared component within Pemmican, accessible to plugins
pub struct Shared<S>
{
    pub pool: CpuPool,
    #[allow(dead_code)] // this is provided for handlers; this library does not use it
    pub state: S,
}

impl<S> Shared<S>
{
    pub fn new(num_threads: usize, state: S) -> Shared<S> {
        Shared {
            pool: CpuPool::new(num_threads),
            state: state,
        }
    }
}