pub fn scope<'env, Output>(
&'env self,
body: impl for<'scope> FnOnce(&'scope Scope<'scope, 'env>) -> Result<Output, Error>,
) -> Result<Output, Error>
A verb borrows what it reads and writes for the whole scope, so none of it can be touched
before the join.
Examples
use numkong::{Capabilities, ShapesPackedMatrix, Stream};
let triangle = [[1.0_f32, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]];
let packs = ShapesPackedMatrix::new(&[&triangle[..]])?;
let stream = Stream::default(Capabilities::cpu_enabled());
let mut distances = [1.0_f64; 1];
stream.scope(|scope| packs.rmsds_on(scope, &packs, &mut distances))?;
assert!(distances[0] < 1e-6);