diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-08-13 16:03:57 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-08-13 16:03:57 +0100 |
commit | d2212a49f6d447a14cdc87a9de2a4844e78b6905 (patch) | |
tree | b9c7e76342b631709ecc7cea807dd82a43539312 /crates/ide_db/src/wasm_shims.rs | |
parent | e9926948ca267932ccc1341388bfd1b3fa88a001 (diff) | |
parent | ae3abd6e575940eb1221acf26c09e96352f052fa (diff) |
Merge #5748
5748: Rename ra_ssr -> ssr
r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ide_db/src/wasm_shims.rs')
-rw-r--r-- | crates/ide_db/src/wasm_shims.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/ide_db/src/wasm_shims.rs b/crates/ide_db/src/wasm_shims.rs new file mode 100644 index 000000000..7af9f9d9b --- /dev/null +++ b/crates/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"))] | ||
4 | pub use std::time::Instant; | ||
5 | |||
6 | #[cfg(feature = "wasm")] | ||
7 | #[derive(Clone, Copy, Debug)] | ||
8 | pub struct Instant; | ||
9 | |||
10 | #[cfg(feature = "wasm")] | ||
11 | impl 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 | } | ||