Skip to main content

rust_bash/
platform.rs

1//! Platform abstraction for types that differ between native and WASM.
2//!
3//! On native targets, re-exports from `std::time`.
4//! On `wasm32`, re-exports from `web_time` which uses `js_sys::Date` under the hood.
5
6#[cfg(target_arch = "wasm32")]
7pub use web_time::{Instant, SystemTime, UNIX_EPOCH};
8
9#[cfg(not(target_arch = "wasm32"))]
10pub use std::time::{Instant, SystemTime, UNIX_EPOCH};