-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable
instant
only for wasm32
targets
... and hide the dependency under a `time` module in `iced_native`
- Loading branch information
Showing
6 changed files
with
19 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<std::time::Instant> { | ||
pub fn every(duration: Duration) -> Subscription<Instant> { | ||
iced_futures::time::every(duration) | ||
} |