Can anybody enlighten me what the purpose of the Instant newtype wrapper in @rustlang @tokio_rs is? At a first glance it does not seem to do anything but to delegate to std::time::Instant...
https://docs.rs/tokio/0.2.19/src/tokio/time/instant.rs.html#10-12 …
-
-
I don't know for sure for tokio, but considering that `Instant::now` panics when compiled for wasm32-unknown-unknown, it is useful to wrap around it and delegate the call to a JS function instead.
1 reply 0 retweets 1 like -
Thanks. That's it. All the other stuff in Instant is pure computation, but now requires an environment. Looking some more, now is implemented in 2 different ways depending on the test_util feature. https://docs.rs/tokio/0.2.19/src/tokio/time/instant.rs.html#184 …
1 reply 0 retweets 0 likes
It allows mocking out time to make time based tests deterministic. See https://github.com/tokio-rs/mini-redis/blob/master/tests/server.rs#L59-L120 … There is some work going into generalizing the strategy to other components.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.