diff --git a/examples/winit-example/src/main.rs b/examples/winit-example/src/main.rs index 361a95d..813a89c 100644 --- a/examples/winit-example/src/main.rs +++ b/examples/winit-example/src/main.rs @@ -41,6 +41,7 @@ fn main() { } event::Event::WindowEvent { event, .. } => match event { WindowEvent::CloseRequested { .. } => *control_flow = ControlFlow::Exit, + #[cfg(not(target_arch = "wasm32"))] WindowEvent::KeyboardInput { input: event::KeyboardInput { diff --git a/examples/winit-example/wasm-build.sh b/examples/winit-example/wasm-build.sh old mode 100644 new mode 100755 index 606cb68..9373379 --- a/examples/winit-example/wasm-build.sh +++ b/examples/winit-example/wasm-build.sh @@ -1,2 +1,3 @@ +#!/bin/sh cargo build --target wasm32-unknown-unknown wasm-bindgen --out-dir dist --web target/wasm32-unknown-unknown/debug/wasm-example.wasm \ No newline at end of file diff --git a/src/backend/wasm.rs b/src/backend/wasm.rs index 961f507..5ced0d9 100644 --- a/src/backend/wasm.rs +++ b/src/backend/wasm.rs @@ -150,8 +150,6 @@ impl Drop for WasmDialog { } } -use std::future::Future; - use super::{AsyncFilePickerDialogImpl, DialogFutureType}; impl AsyncFilePickerDialogImpl for FileDialog { diff --git a/src/file_dialog.rs b/src/file_dialog.rs index 4fb3210..de5ec42 100644 --- a/src/file_dialog.rs +++ b/src/file_dialog.rs @@ -7,6 +7,7 @@ use raw_window_handle::{HasRawWindowHandle, RawWindowHandle}; #[derive(Debug, Clone)] pub(crate) struct Filter { + #[allow(dead_code)] pub name: String, pub extensions: Vec, } @@ -30,6 +31,7 @@ unsafe impl Send for FileDialog {} impl FileDialog { /// New file dialog builder + #[cfg(not(target_arch = "wasm32"))] pub fn new() -> Self { Default::default() } @@ -86,6 +88,7 @@ impl FileDialog { } } +#[cfg(not(target_arch = "wasm32"))] use crate::backend::{FilePickerDialogImpl, FileSaveDialogImpl, FolderPickerDialogImpl}; #[cfg(not(target_arch = "wasm32"))] @@ -195,9 +198,10 @@ impl AsyncFileDialog { } } -use crate::backend::{ - AsyncFilePickerDialogImpl, AsyncFileSaveDialogImpl, AsyncFolderPickerDialogImpl, -}; +use crate::backend::AsyncFilePickerDialogImpl; +#[cfg(not(target_arch = "wasm32"))] +use crate::backend::{AsyncFileSaveDialogImpl, AsyncFolderPickerDialogImpl}; + use std::future::Future; impl AsyncFileDialog {