rough-minister-58256
03/31/2017, 12:55 AMpool.unwrap().spawn_fn(ā¦)
rough-minister-58256
03/31/2017, 12:55 AMrough-minister-58256
03/31/2017, 12:55 AMerror[E0507]: cannot move out of borrowed content
--> src/rust/engine/src/graph.rs:115:24
|
115 | let pool = context_factory.pool().expect("Uninitialized CpuPool!");
| ^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
error: aborting due to previous error
rough-minister-58256
03/31/2017, 12:55 AMrough-minister-58256
03/31/2017, 1:53 AMself
by value in Core::pool()
and give the RwLockReadGuard<Option<CpuPool>>
a lifetime?witty-crayon-22786
03/31/2017, 1:55 AMrough-minister-58256
03/31/2017, 1:55 AMrough-minister-58256
03/31/2017, 1:55 AMwitty-crayon-22786
03/31/2017, 1:55 AMunwrap
or expect("There should be a pool installed")
therewitty-crayon-22786
03/31/2017, 1:56 AMrough-minister-58256
03/31/2017, 1:56 AMwitty-crayon-22786
03/31/2017, 1:56 AMfn unwrap(self) -> T
witty-crayon-22786
03/31/2017, 1:56 AMwitty-crayon-22786
03/31/2017, 1:57 AMoption.as_ref().unwrap()
witty-crayon-22786
03/31/2017, 1:57 AMrough-minister-58256
03/31/2017, 1:57 AMwitty-crayon-22786
03/31/2017, 1:57 AMfn as_ref(&self) -> Option<&T>
witty-crayon-22786
03/31/2017, 1:57 AMwitty-crayon-22786
03/31/2017, 1:57 AMunwrap
above... it doesn't take by reference, and that's the issuewitty-crayon-22786
03/31/2017, 1:58 AMwitty-crayon-22786
03/31/2017, 1:58 AMas_ref()
gives you a new option containing a reference, which you can consumerough-minister-58256
03/31/2017, 1:58 AMwitty-crayon-22786
03/31/2017, 1:59 AMwitty-crayon-22786
03/31/2017, 1:59 AMrough-minister-58256
03/31/2017, 1:59 AMrough-minister-58256
03/31/2017, 1:59 AMrough-minister-58256
03/31/2017, 2:03 AMrough-minister-58256
03/31/2017, 2:03 AMrough-minister-58256
03/31/2017, 2:05 AMrough-minister-58256
03/31/2017, 2:30 AMpre_fork()
approach