aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db/src/wasm_shims.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-06 14:14:47 +0000
committerGitHub <[email protected]>2020-02-06 14:14:47 +0000
commitff2d77bde6acffc5e4c42878606b3d6d92300e11 (patch)
tree76b0a8bbf94b0c68dd3aa891e0d9ea5cdf067863 /crates/ra_ide_db/src/wasm_shims.rs
parent19de59a9233a09a9b70a96a6c49213b119819c46 (diff)
parent355c98fd0861acf0f0fddad08cbc923fee0698fb (diff)
Merge #3029
3029: Docs r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_db/src/wasm_shims.rs')
-rw-r--r--crates/ra_ide_db/src/wasm_shims.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/ra_ide_db/src/wasm_shims.rs b/crates/ra_ide_db/src/wasm_shims.rs
new file mode 100644
index 000000000..7af9f9d9b
--- /dev/null
+++ b/crates/ra_ide_db/src/wasm_shims.rs
@@ -0,0 +1,19 @@
1//! A version of `std::time::Instant` that doesn't panic in WASM.
2
3#[cfg(not(feature = "wasm"))]
4pub use std::time::Instant;
5
6#[cfg(feature = "wasm")]
7#[derive(Clone, Copy, Debug)]
8pub struct Instant;
9
10#[cfg(feature = "wasm")]
11impl Instant {
12 pub fn now() -> Self {
13 Self
14 }
15
16 pub fn elapsed(&self) -> std::time::Duration {
17 std::time::Duration::new(0, 0)
18 }
19}