Skip to content

Commit

Permalink
Use instant instead of wasm-timer in iced_core
Browse files Browse the repository at this point in the history
  • Loading branch information
hecrj committed Jan 12, 2023
1 parent fc54d6b commit d02810a
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ version = "0.6"
optional = true

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-timer = { version = "0.2" }
instant = "0.1"
6 changes: 5 additions & 1 deletion core/src/time.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
//! Keep track of time, both in native and web platforms!
#[cfg(target_arch = "wasm32")]
pub use wasm_timer::Instant;
pub use instant::Instant;

#[cfg(target_arch = "wasm32")]
pub use instant::Duration;

#[cfg(not(target_arch = "wasm32"))]
pub use std::time::Instant;

#[cfg(not(target_arch = "wasm32"))]
pub use std::time::Duration;
1 change: 0 additions & 1 deletion glutin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ system = ["iced_winit/system"]

[dependencies]
log = "0.4"
instant = "0.1"

[dependencies.glutin]
version = "0.29"
Expand Down
2 changes: 1 addition & 1 deletion glutin/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ use iced_winit::conversion;
use iced_winit::futures;
use iced_winit::futures::channel::mpsc;
use iced_winit::renderer;
use iced_winit::time::Instant;
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;

#[cfg(feature = "tracing")]
Expand Down
3 changes: 1 addition & 2 deletions native/src/widget/text_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::layout;
use crate::mouse::{self, click};
use crate::renderer;
use crate::text::{self, Text};
use crate::time::{Duration, Instant};
use crate::touch;
use crate::widget;
use crate::widget::operation::{self, Operation};
Expand All @@ -28,8 +29,6 @@ use crate::{
Rectangle, Shell, Size, Vector, Widget,
};

use instant::{Duration, Instant};

pub use iced_style::text_input::{Appearance, StyleSheet};

/// A field that can be filled with text.
Expand Down
3 changes: 1 addition & 2 deletions native/src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ pub use redraw_request::RedrawRequest;
pub use user_attention::UserAttention;

use crate::subscription::{self, Subscription};

use instant::Instant;
use crate::time::Instant;

/// Subscribes to the frames of the window of the running application.
///
Expand Down
3 changes: 2 additions & 1 deletion native/src/window/event.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use instant::Instant;
use crate::time::Instant;

use std::path::PathBuf;

/// A window-related event.
Expand Down
2 changes: 1 addition & 1 deletion native/src/window/redraw_request.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use instant::Instant;
use crate::time::Instant;

/// A request to redraw a window.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
Expand Down
1 change: 0 additions & 1 deletion winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ application = []
window_clipboard = "0.2"
log = "0.4"
thiserror = "1.0"
instant = "0.1"

[dependencies.winit]
version = "0.27"
Expand Down
2 changes: 1 addition & 1 deletion winit/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ use iced_futures::futures::channel::mpsc;
use iced_graphics::compositor;
use iced_graphics::window;
use iced_native::program::Program;
use iced_native::time::Instant;
use iced_native::user_interface::{self, UserInterface};

pub use iced_native::application::{Appearance, StyleSheet};

use instant::Instant;
use std::mem::ManuallyDrop;

#[cfg(feature = "trace")]
Expand Down

0 comments on commit d02810a

Please sign in to comment.