summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/Cargo.toml3
-rw-r--r--core/README.md2
-rw-r--r--core/src/lib.rs1
-rw-r--r--core/src/time.rs9
4 files changed, 14 insertions, 1 deletions
diff --git a/core/Cargo.toml b/core/Cargo.toml
index ca28c308..dde34326 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -13,3 +13,6 @@ bitflags = "1.2"
[dependencies.palette]
version = "0.5"
optional = true
+
+[target.'cfg(target_arch = "wasm32")'.dependencies]
+wasm-timer = { version = "0.2" }
diff --git a/core/README.md b/core/README.md
index c16eb779..bbb7983c 100644
--- a/core/README.md
+++ b/core/README.md
@@ -2,7 +2,7 @@
[![Documentation](https://docs.rs/iced_core/badge.svg)][documentation]
[![Crates.io](https://img.shields.io/crates/v/iced_core.svg)](https://crates.io/crates/iced_core)
[![License](https://img.shields.io/crates/l/iced_core.svg)](https://github.com/iced-rs/iced/blob/master/LICENSE)
-[![project chat](https://img.shields.io/badge/chat-on_zulip-brightgreen.svg)](https://iced.zulipchat.com)
+[![Discord Server](https://img.shields.io/discord/628993209984614400?label=&labelColor=6A7EC2&logo=discord&logoColor=ffffff&color=7389D8)](https://discord.gg/3xZJ65GAhd)
`iced_core` holds basic reusable types of the public API. For instance, basic data types like `Point`, `Rectangle`, `Length`, etc.
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..f496d1a4
--- /dev/null
+++ b/core/src/time.rs
@@ -0,0 +1,9 @@
+//! Keep track of time, both in native and web platforms!
+
+#[cfg(target_arch = "wasm32")]
+pub use wasm_timer::Instant;
+
+#[cfg(not(target_arch = "wasm32"))]
+pub use std::time::Instant;
+
+pub use std::time::Duration;