Skip to content

Instantly share code, notes, and snippets.

@eholk
Created May 18, 2012 18:51
Show Gist options
  • Select an option

  • Save eholk/2727019 to your computer and use it in GitHub Desktop.

Select an option

Save eholk/2727019 to your computer and use it in GitHub Desktop.
let len = xs.len();
let end = uint::min(len, base + items_per_task);
vec::unpack_slice::<A, ()>(xs) {|p, _len|
let slice = (ptr::offset(p, base), end - base);
let f = ptr::addr_of(f);
futures += [future::spawn() {|copy base|
unsafe {
let slice : [const A]/& =
unsafe::reinterpret_cast(slice);
(*f)(base, slice)
}
}];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment