From 83c649b574d90667d23c8430baaebcd0ef933055 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 28 Jan 2022 17:20:40 +0700 Subject: Move `time` module from `iced_native` to `iced_core` --- core/Cargo.toml | 4 ++++ core/src/lib.rs | 1 + core/src/time.rs | 7 +++++++ native/Cargo.toml | 4 ---- native/src/lib.rs | 2 +- native/src/time.rs | 7 ------- 6 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 core/src/time.rs delete mode 100644 native/src/time.rs diff --git a/core/Cargo.toml b/core/Cargo.toml index ca28c308..83458ac0 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -13,3 +13,7 @@ bitflags = "1.2" [dependencies.palette] version = "0.5" optional = true + +[target.'cfg(target_arch = "wasm32")'.dependencies.instant] +version = "0.1" +features = ["wasm-bindgen"] diff --git a/core/src/lib.rs b/core/src/lib.rs index b76c6d20..2a4e6158 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -17,6 +17,7 @@ pub mod alignment; pub mod keyboard; pub mod mouse; +pub mod time; mod background; mod color; diff --git a/core/src/time.rs b/core/src/time.rs new file mode 100644 index 00000000..5f95ee86 --- /dev/null +++ b/core/src/time.rs @@ -0,0 +1,7 @@ +//! Keep track of time, both in native and web platforms! + +#[cfg(target_arch = "wasm32")] +pub use instant::{Duration, Instant}; + +#[cfg(not(target_arch = "wasm32"))] +pub use std::time::{Duration, Instant}; diff --git a/native/Cargo.toml b/native/Cargo.toml index 499ad29e..8f0aea6a 100644 --- a/native/Cargo.toml +++ b/native/Cargo.toml @@ -27,7 +27,3 @@ features = ["thread-pool"] [dependencies.iced_style] version = "0.3" path = "../style" - -[target.'cfg(target_arch = "wasm32")'.dependencies.instant] -version = "0.1" -features = ["wasm-bindgen"] diff --git a/native/src/lib.rs b/native/src/lib.rs index bd50c6b2..6d98f7d1 100644 --- a/native/src/lib.rs +++ b/native/src/lib.rs @@ -49,7 +49,6 @@ pub mod renderer; pub mod subscription; pub mod svg; pub mod text; -pub mod time; pub mod touch; pub mod user_interface; pub mod widget; @@ -70,6 +69,7 @@ mod debug; mod debug; pub use iced_core::alignment; +pub use iced_core::time; pub use iced_core::{ Alignment, Background, Color, Font, Length, Padding, Point, Rectangle, Size, Vector, diff --git a/native/src/time.rs b/native/src/time.rs deleted file mode 100644 index 5f95ee86..00000000 --- a/native/src/time.rs +++ /dev/null @@ -1,7 +0,0 @@ -//! Keep track of time, both in native and web platforms! - -#[cfg(target_arch = "wasm32")] -pub use instant::{Duration, Instant}; - -#[cfg(not(target_arch = "wasm32"))] -pub use std::time::{Duration, Instant}; -- cgit