Skip to content
Snippets Groups Projects
Verified Commit 3b7d2cc8 authored by Louis's avatar Louis :fire:
Browse files

Update Crate metadata

parent eccb3d31
No related branches found
No related tags found
No related merge requests found
[package]
name = "web_instant"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
description = "Cross platform impl of Instant"
authors = [
......@@ -8,6 +8,8 @@ authors = [
]
repository = "https://lab.lcr.gr/microhacks/web-instant"
homepage = "https://lab.lcr.gr/microhacks/web-instant"
documentation = "https://docs.rs/web_instant"
license = "Apache-2.0"
[target."wasm32-unknown-unknown".dependencies]
......
# Web Instant
Provides `Spot`, a version of `Instant` that works both on desktop and the web. On desktop, the internal representation uses `std::time::Instant`. On the web, the internal representation is an `f64`,
Provides `Spot`, a version of `Instant` that works both in environments that support `Instant` and `wasm` family targets. On desktop, the internal representation uses `std::time::Instant`. On the web, the internal representation is an `f64`,
and uses `js_sys::Date` methods to cover functinality where required
All the methods on `Instant` are implemented for `Spot`, so you can just replace uses of `std::time::Instant` with `web_instant::Spot`
......
//! # Web Instant
//!
//! Provides `Spot`, a version of `Instant` that works both in environments that support `Instant` and `wasm` family targets. On desktop, the internal representation uses `std::time::Instant`. On the web, the internal representation is an `f64`,
//! and uses `js_sys::Date` methods to cover functinality where required
//!
//! All the methods on `Instant` are implemented for `Spot`, so you can just replace uses of `std::time::Instant` with `web_instant::Spot`
//!
//! ## Install
//!
//! `cargo add web_instant`
//!
//! ## Usage
//!
//! ```rust
//! use web_instant::Spot;
//! use std::time::Duration;
//!
//! fn my_cross_platform_timer(last_time: Spot) {
//! let time_diff: Duration = Spot::now() - last_time;
//! println!("It has been {} seconds", time_diff.as_secs());
//! }
//! ```
#[cfg(not(target_family = "wasm"))]
mod instant_desktop;
#[cfg(target_family = "wasm")]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment