From 5cc84f32dbe142959ea5cd1f772aa8363c0dc837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Mon, 1 Jul 2019 20:43:54 +0200 Subject: [PATCH] Improve feature names to enable web backends --- Cargo.toml | 10 ++++++---- src/lib.rs | 4 ++-- src/platform/web.rs | 8 ++++---- src/platform_impl/web/mod.rs | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c8724fdf..d0e5f1b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,8 +14,8 @@ categories = ["gui"] features = ["serde"] [features] -use_web-sys = ["web-sys", "wasm-bindgen", "instant/wasm-bindgen"] -use_stdweb = ["stdweb", "instant/stdweb"] +web-sys = ["web_sys", "wasm-bindgen", "instant/wasm-bindgen"] +stdweb = ["std_web", "instant/stdweb"] [dependencies] instant = "0.1" @@ -78,7 +78,8 @@ percent-encoding = "1.0" [target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "windows"))'.dependencies.parking_lot] version = "0.8" -[target.'cfg(target_arch = "wasm32")'.dependencies.web-sys] +[target.'cfg(target_arch = "wasm32")'.dependencies.web_sys] +package = "web-sys" version = "0.3.22" optional = true features = [ @@ -103,7 +104,8 @@ features = [ version = "0.2.45" optional = true -[target.'cfg(target_arch = "wasm32")'.dependencies.stdweb] +[target.'cfg(target_arch = "wasm32")'.dependencies.std_web] +package = "stdweb" version = "0.4.17" optional = true diff --git a/src/lib.rs b/src/lib.rs index 51e74408..ada920a2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -135,9 +135,9 @@ extern crate smithay_client_toolkit as sctk; target_os = "openbsd" ))] extern crate x11_dl; -#[cfg(feature = "stdweb")] +#[cfg(feature = "std_web")] #[macro_use] -extern crate stdweb; +extern crate std_web as stdweb; #[cfg(any( target_os = "linux", target_os = "dragonfly", diff --git a/src/platform/web.rs b/src/platform/web.rs index 3ed460ea..edb37f8b 100644 --- a/src/platform/web.rs +++ b/src/platform/web.rs @@ -1,15 +1,15 @@ -#[cfg(feature = "use_stdweb")] +#[cfg(feature = "stdweb")] use stdweb::web::html_element::CanvasElement; -#[cfg(feature = "use_stdweb")] +#[cfg(feature = "stdweb")] pub trait WindowExtStdweb { fn canvas(&self) -> CanvasElement; } -#[cfg(feature = "use_web-sys")] +#[cfg(feature = "web-sys")] use web_sys::HtmlCanvasElement; -#[cfg(feature = "use_web-sys")] +#[cfg(feature = "web-sys")] pub trait WindowExtWebSys { fn canvas(&self) -> HtmlCanvasElement; } diff --git a/src/platform_impl/web/mod.rs b/src/platform_impl/web/mod.rs index 7ff671ee..ca321b09 100644 --- a/src/platform_impl/web/mod.rs +++ b/src/platform_impl/web/mod.rs @@ -11,11 +11,11 @@ mod event_loop; mod monitor; mod window; -#[cfg(feature = "use_web-sys")] +#[cfg(feature = "web-sys")] #[path = "web_sys/mod.rs"] mod backend; -#[cfg(feature = "use_stdweb")] +#[cfg(feature = "stdweb")] #[path = "stdweb/mod.rs"] mod backend;