diff options
Diffstat (limited to 'core/src/default_impl/cpupool.rs')
-rw-r--r-- | core/src/default_impl/cpupool.rs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/core/src/default_impl/cpupool.rs b/core/src/default_impl/cpupool.rs index de02deb..87cb5e5 100644 --- a/core/src/default_impl/cpupool.rs +++ b/core/src/default_impl/cpupool.rs @@ -1,8 +1,7 @@ - use futures::Future; use utils::SendBoxFuture; -use futures_cpupool::{ CpuPool, Builder}; +use futures_cpupool::{Builder, CpuPool}; use context::OffloaderComponent; @@ -18,30 +17,32 @@ pub fn simple_cpu_pool() -> CpuPool { impl OffloaderComponent for CpuPool { /// executes the futures `fut` "elswhere" e.g. in a cpu pool fn offload<F>(&self, fut: F) -> SendBoxFuture<F::Item, F::Error> - where F: Future + Send + 'static, - F::Item: Send+'static, - F::Error: Send+'static + where + F: Future + Send + 'static, + F::Item: Send + 'static, + F::Error: Send + 'static, { - Box::new( self.spawn( fut ) ) + Box::new(self.spawn(fut)) } } - #[cfg(test)] mod test { + use super::*; use futures::future; use futures_cpupool::Builder; - use super::*; #[test] fn check_if_it_works() { let pool = Builder::new().create(); - _check_if_it_works( pool ) + _check_if_it_works(pool) } fn _check_if_it_works<R: OffloaderComponent>(r: R) { - let res = r.offload(future::lazy(||-> Result<u32, ()> { Ok(33u32) } )).wait(); - let val = assert_ok!( res ); - assert_eq!( 33u32, val ); + let res = r + .offload(future::lazy(|| -> Result<u32, ()> { Ok(33u32) })) + .wait(); + let val = assert_ok!(res); + assert_eq!(33u32, val); } -}
\ No newline at end of file +} |