mirror of
https://github.com/rustwasm/wasm-bindgen.git
synced 2025-01-01 16:04:51 +03:00
Update raytrace-parallel to rust 2018
This commit is contained in:
parent
01fa5dd6c9
commit
bfcecb426e
@ -2,6 +2,7 @@
|
|||||||
name = "raytrace-parallel"
|
name = "raytrace-parallel"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["The wasm-bindgen Developers"]
|
authors = ["The wasm-bindgen Developers"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
crate-type = ["cdylib"]
|
crate-type = ["cdylib"]
|
||||||
|
@ -1,9 +1,3 @@
|
|||||||
extern crate futures;
|
|
||||||
extern crate js_sys;
|
|
||||||
extern crate raytracer;
|
|
||||||
extern crate wasm_bindgen;
|
|
||||||
extern crate web_sys;
|
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
@ -88,7 +82,7 @@ impl Scene {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}) as Box<FnMut(_) -> Result<(), JsValue>>);
|
}) as Box<dyn FnMut(_) -> Result<(), JsValue>>);
|
||||||
|
|
||||||
for worker in &pool.workers[..concurrency] {
|
for worker in &pool.workers[..concurrency] {
|
||||||
let ptr_to_send = Arc::into_raw(r.shared.clone()) as u32;
|
let ptr_to_send = Arc::into_raw(r.shared.clone()) as u32;
|
||||||
@ -112,7 +106,7 @@ impl Scene {
|
|||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub struct WorkerPool {
|
pub struct WorkerPool {
|
||||||
workers: Vec<Worker>,
|
workers: Vec<Worker>,
|
||||||
callback: Closure<FnMut(Event)>,
|
callback: Closure<dyn FnMut(Event)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
@ -193,7 +187,7 @@ impl RenderingScene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct Render {
|
struct Render {
|
||||||
callback: Option<Closure<FnMut(Event) -> Result<(), JsValue>>>,
|
callback: Option<Closure<dyn FnMut(Event) -> Result<(), JsValue>>>,
|
||||||
tx: Option<oneshot::Sender<()>>,
|
tx: Option<oneshot::Sender<()>>,
|
||||||
shared: Arc<Shared>,
|
shared: Arc<Shared>,
|
||||||
ctx: CanvasRenderingContext2d,
|
ctx: CanvasRenderingContext2d,
|
||||||
@ -326,7 +320,7 @@ impl Shared {
|
|||||||
fn update_image(
|
fn update_image(
|
||||||
&self,
|
&self,
|
||||||
done: bool,
|
done: bool,
|
||||||
data: MutexGuard<Vec<u8>>,
|
data: MutexGuard<'_,Vec<u8>>,
|
||||||
global: &DedicatedWorkerGlobalScope,
|
global: &DedicatedWorkerGlobalScope,
|
||||||
) -> Result<(), JsValue> {
|
) -> Result<(), JsValue> {
|
||||||
// This is pretty icky. We can't create an `ImageData` backed by
|
// This is pretty icky. We can't create an `ImageData` backed by
|
||||||
|
Loading…
Reference in New Issue
Block a user