From f6ae28c36d857f72326df2d35eafbef840de2993 Mon Sep 17 00:00:00 2001 From: boxdot Date: Thu, 12 Nov 2020 09:48:40 +0100 Subject: [PATCH] Enable h2 to be able to run in browser environment. This replaces Instant by a more generate wasm_timer::Instant. --- Cargo.toml | 1 + src/proto/streams/recv.rs | 3 ++- src/proto/streams/stream.rs | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 42f78b808..c70129fe3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,7 @@ tracing-futures = { version = "0.2", default-features = false, features = ["std- fnv = "1.0.5" slab = "0.4.2" indexmap = "1.0" +wasm-timer = { version = "0.2.5" } [dev-dependencies] diff --git a/src/proto/streams/recv.rs b/src/proto/streams/recv.rs index 682200d45..19b398379 100644 --- a/src/proto/streams/recv.rs +++ b/src/proto/streams/recv.rs @@ -5,10 +5,11 @@ use crate::{frame, proto}; use std::task::Context; use http::{HeaderMap, Request, Response}; +use wasm_timer::Instant; use std::io; use std::task::{Poll, Waker}; -use std::time::{Duration, Instant}; +use std::time::Duration; #[derive(Debug)] pub(super) struct Recv { diff --git a/src/proto/streams/stream.rs b/src/proto/streams/stream.rs index 5bbda250c..ada60cd5b 100644 --- a/src/proto/streams/stream.rs +++ b/src/proto/streams/stream.rs @@ -1,7 +1,8 @@ use super::*; +use wasm_timer::Instant; + use std::task::{Context, Waker}; -use std::time::Instant; use std::usize; /// Tracks Stream related state