From fc54d6ba31246157422d092914ba7c1e483129c4 Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector0193@gmail.com>
Date: Thu, 12 Jan 2023 05:26:39 +0100
Subject: Use `instant` to fix Wasm target

---
 glutin/Cargo.toml                   | 7 ++++---
 glutin/src/application.rs           | 2 +-
 native/Cargo.toml                   | 1 +
 native/src/widget/text_input.rs     | 2 +-
 native/src/window.rs                | 2 +-
 native/src/window/event.rs          | 2 +-
 native/src/window/redraw_request.rs | 2 +-
 winit/Cargo.toml                    | 1 +
 winit/src/application.rs            | 2 +-
 9 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/glutin/Cargo.toml b/glutin/Cargo.toml
index 304170cd..a458ee9e 100644
--- a/glutin/Cargo.toml
+++ b/glutin/Cargo.toml
@@ -15,8 +15,9 @@ trace = ["iced_winit/trace"]
 debug = ["iced_winit/debug"]
 system = ["iced_winit/system"]
 
-[dependencies.log]
-version = "0.4"
+[dependencies]
+log = "0.4"
+instant = "0.1"
 
 [dependencies.glutin]
 version = "0.29"
@@ -39,4 +40,4 @@ features = ["opengl"]
 
 [dependencies.tracing]
 version = "0.1.6"
-optional = true
\ No newline at end of file
+optional = true
diff --git a/glutin/src/application.rs b/glutin/src/application.rs
index 3bb9e61a..a2096ee4 100644
--- a/glutin/src/application.rs
+++ b/glutin/src/application.rs
@@ -15,8 +15,8 @@ use iced_winit::user_interface;
 use iced_winit::{Clipboard, Command, Debug, Event, Proxy, Settings};
 
 use glutin::window::Window;
+use instant::Instant;
 use std::mem::ManuallyDrop;
-use std::time::Instant;
 
 #[cfg(feature = "tracing")]
 use tracing::{info_span, instrument::Instrument};
diff --git a/native/Cargo.toml b/native/Cargo.toml
index bbf92951..040ea454 100644
--- a/native/Cargo.toml
+++ b/native/Cargo.toml
@@ -14,6 +14,7 @@ debug = []
 twox-hash = { version = "1.5", default-features = false }
 unicode-segmentation = "1.6"
 num-traits = "0.2"
+instant = "0.1"
 
 [dependencies.iced_core]
 version = "0.6"
diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs
index ae289069..e5b7d93a 100644
--- a/native/src/widget/text_input.rs
+++ b/native/src/widget/text_input.rs
@@ -28,7 +28,7 @@ use crate::{
     Rectangle, Shell, Size, Vector, Widget,
 };
 
-use std::time::{Duration, Instant};
+use instant::{Duration, Instant};
 
 pub use iced_style::text_input::{Appearance, StyleSheet};
 
diff --git a/native/src/window.rs b/native/src/window.rs
index 6ebe15b1..94201059 100644
--- a/native/src/window.rs
+++ b/native/src/window.rs
@@ -13,7 +13,7 @@ pub use user_attention::UserAttention;
 
 use crate::subscription::{self, Subscription};
 
-use std::time::Instant;
+use instant::Instant;
 
 /// Subscribes to the frames of the window of the running application.
 ///
diff --git a/native/src/window/event.rs b/native/src/window/event.rs
index 16684222..64dd17d7 100644
--- a/native/src/window/event.rs
+++ b/native/src/window/event.rs
@@ -1,5 +1,5 @@
+use instant::Instant;
 use std::path::PathBuf;
-use std::time::Instant;
 
 /// A window-related event.
 #[derive(PartialEq, Eq, Clone, Debug)]
diff --git a/native/src/window/redraw_request.rs b/native/src/window/redraw_request.rs
index 1377823a..be5bd757 100644
--- a/native/src/window/redraw_request.rs
+++ b/native/src/window/redraw_request.rs
@@ -1,4 +1,4 @@
-use std::time::Instant;
+use instant::Instant;
 
 /// A request to redraw a window.
 #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
diff --git a/winit/Cargo.toml b/winit/Cargo.toml
index 94aaa2ca..872b30c8 100644
--- a/winit/Cargo.toml
+++ b/winit/Cargo.toml
@@ -21,6 +21,7 @@ application = []
 window_clipboard = "0.2"
 log = "0.4"
 thiserror = "1.0"
+instant = "0.1"
 
 [dependencies.winit]
 version = "0.27"
diff --git a/winit/src/application.rs b/winit/src/application.rs
index b6485cb7..4d7382cc 100644
--- a/winit/src/application.rs
+++ b/winit/src/application.rs
@@ -24,8 +24,8 @@ use iced_native::user_interface::{self, UserInterface};
 
 pub use iced_native::application::{Appearance, StyleSheet};
 
+use instant::Instant;
 use std::mem::ManuallyDrop;
-use std::time::Instant;
 
 #[cfg(feature = "trace")]
 pub use profiler::Profiler;
-- 
cgit