Skip to main content

juncture_core/
time.rs

1//! Platform-compatible time abstractions.
2//!
3//! - Native: re-exports [`std::time::Instant`].
4//! - Browser WASM (`wasm32-unknown-unknown`): re-exports [`web_time::Instant`]
5//!   which uses `performance.now()` instead of panicking.
6//! - WASI (`wasm32-wasip1`/`wasm32-wasip2`): re-exports [`std::time::Instant`]
7//!   which works natively via WASI clock APIs.
8
9/// Platform-compatible instant type.
10///
11/// - Native / WASI: [`std::time::Instant`]
12/// - Browser WASM: [`web_time::Instant`] (uses `performance.now()`)
13#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
14pub use std::time::Instant;
15
16/// Platform-compatible instant type.
17///
18/// - Native / WASI: [`std::time::Instant`]
19/// - Browser WASM: [`web_time::Instant`] (uses `performance.now()`)
20#[cfg(all(target_family = "wasm", target_os = "unknown"))]
21pub use web_time::Instant;