From 87b3e03d187237f665b376018ea5af0cc5f05814 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 28 Jan 2022 17:05:09 +0700 Subject: Enable `instant` only for `wasm32` targets ... and hide the dependency under a `time` module in `iced_native` --- src/time.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/time.rs') diff --git a/src/time.rs b/src/time.rs index b8432895..943aa42f 100644 --- a/src/time.rs +++ b/src/time.rs @@ -1,12 +1,12 @@ //! Listen and react to time. +pub use crate::runtime::time::{Duration, Instant}; + use crate::Subscription; /// Returns a [`Subscription`] that produces messages at a set interval. /// /// The first message is produced after a `duration`, and then continues to /// produce more messages every `duration` after that. -pub fn every( - duration: std::time::Duration, -) -> Subscription { +pub fn every(duration: Duration) -> Subscription { iced_futures::time::every(duration) } -- cgit From 167be45a7db7c1f60a79116766bdf38300429c6a Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 28 Jan 2022 18:24:07 +0700 Subject: Split `iced_futures` into different `backend` implementations --- src/time.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'src/time.rs') diff --git a/src/time.rs b/src/time.rs index 943aa42f..4f831171 100644 --- a/src/time.rs +++ b/src/time.rs @@ -1,12 +1,2 @@ //! Listen and react to time. -pub use crate::runtime::time::{Duration, Instant}; - -use crate::Subscription; - -/// Returns a [`Subscription`] that produces messages at a set interval. -/// -/// The first message is produced after a `duration`, and then continues to -/// produce more messages every `duration` after that. -pub fn every(duration: Duration) -> Subscription { - iced_futures::time::every(duration) -} +pub use iced_futures::backend::default::time::*; -- cgit From e730d97f61bc2edc77d2f061b6a763c4d0a948df Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 28 Jan 2022 18:43:20 +0700 Subject: Implement `time` module for `wasm-bindgen` backend in `iced_futures` --- src/time.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/time.rs') diff --git a/src/time.rs b/src/time.rs index 4f831171..37d454ed 100644 --- a/src/time.rs +++ b/src/time.rs @@ -1,2 +1,4 @@ //! Listen and react to time. +pub use iced_core::time::{Duration, Instant}; + pub use iced_futures::backend::default::time::*; -- cgit