aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db/src/wasm_shims.rs
blob: 7af9f9d9bb7bdafcd852e474572a1aca06dcadd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! A version of `std::time::Instant` that doesn't panic in WASM.

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

#[cfg(feature = "wasm")]
#[derive(Clone, Copy, Debug)]
pub struct Instant;

#[cfg(feature = "wasm")]
impl Instant {
    pub fn now() -> Self {
        Self
    }

    pub fn elapsed(&self) -> std::time::Duration {
        std::time::Duration::new(0, 0)
    }
}