diff --git a/src/app/scene/mod.rs b/src/app/scene/mod.rs index 06f2df8..4cd182d 100644 --- a/src/app/scene/mod.rs +++ b/src/app/scene/mod.rs @@ -26,7 +26,7 @@ thread_local! { /// Sadly we can't just create a [`scene::Context`] in [`MyApp::new`] and pass it /// to the [`egui::PaintCallback`] because [`scene::Context`] isn't `Send+Sync`, which /// [`egui::PaintCallback`] is. - pub static SCENE: RefCell> = RefCell::new(None); + pub static SCENE: RefCell> = const { RefCell::new(None) }; } /// Renders the main 3D scene, containing the SDF object diff --git a/src/run.rs b/src/run.rs index 1463c9a..a1d7c16 100644 --- a/src/run.rs +++ b/src/run.rs @@ -116,9 +116,7 @@ pub fn native_main(sync: bool, event_loop_builder: EventLoopBuilderHook) -> Pin< event_loop_builder, ..eframe::NativeOptions::default() }; - println!("Starting native app"); eframe::run_native("SDF Viewer", native_options, app_creator.unwrap()).unwrap(); - println!("Native app exited"); } }; if sync { diff --git a/src/sdf/wasm/load.rs b/src/sdf/wasm/load.rs index 85c9404..1b03890 100644 --- a/src/sdf/wasm/load.rs +++ b/src/sdf/wasm/load.rs @@ -111,7 +111,7 @@ fn handle_sdf_data_response(data: ehttp::Result, watch_url_clos tracing::error!("Failed to load SDF from URL: {:?}", err); sender_single_update.try_send(unsafe { // FIXME: Extremely unsafe code (forcing SDFDemo Send+Sync), but only used for this error path - std::mem::transmute(Box::new(SDFDemo::default()) as Box) + std::mem::transmute::, Box>(Box::new(SDFDemo::default()) as Box) }).map_err(|_| anyhow!("can't send SDF update")) } #[cfg(not(target_arch = "wasm32"))] @@ -132,7 +132,7 @@ fn handle_sdf_data_response(data: ehttp::Result, watch_url_clos tracing::error!("Failed to load SDF from URL ({:?}) or file ({:?})", err, err2); sender_single_update.try_send(unsafe { // FIXME: Extremely unsafe code (forcing SDFDemo Send+Sync), but only used for this error path - std::mem::transmute(Box::::default() as Box) + std::mem::transmute::, Box>(Box::::default() as Box) }).map_err(|_| anyhow!("can't send SDF update")) } } diff --git a/src/sdf/wasm/mod.rs b/src/sdf/wasm/mod.rs index d5fb273..f7b6346 100644 --- a/src/sdf/wasm/mod.rs +++ b/src/sdf/wasm/mod.rs @@ -5,9 +5,10 @@ //! # WebAssembly API specification //! //! The WebAssembly module: +//! //! - MUST NOT use any import from the host (it may have unused imports). //! - MUST export (at least) the required methods from the [`SDF`](crate::sdf::SDFSurface) trait -//! (check the documentation of the trait). +//! (check the documentation of the trait). //! //! As an SDF can provide access to the whole hierarchy it contains, each function must have an extra //! initial parameter indicating the ID (u32) of the SDF it refers to, with 0 being the root SDF. diff --git a/src/sdf/wasm/native.rs b/src/sdf/wasm/native.rs index 00e31d5..5897ac7 100644 --- a/src/sdf/wasm/native.rs +++ b/src/sdf/wasm/native.rs @@ -24,7 +24,7 @@ compile_error!("On wasm32 targets, you need to enable the web feature (and disab /// Loads the given bytes as a WebAssembly module that is then queried to satisfy the SDF trait. pub async fn load_sdf_wasm(wasm_bytes: &[u8]) -> anyhow::Result> { - unsafe { std::mem::transmute(load_sdf_wasm_send_sync(wasm_bytes).await?) } + unsafe { std::mem::transmute::>, anyhow::Result>>(load_sdf_wasm_send_sync(wasm_bytes).await) } } /// Loads the given bytes as a WebAssembly module that is then queried to satisfy the SDF trait.