Closed daxpedda closed 1 year ago
I'm on mobile at the moment, but I'm fairly certain this sort of thing has been brought up before in some way or another. time::Instant
is intended to be a wrapper around std::time::Instant
for the sole reason to provide additional trait impls and methods. Ultimately the issue is upstream, which is where it should be fixed if desired.
Currently calling
Instant::now()
just panics on wasm in the browser, this is a known issue in std and will probably never get fixed without a new target specifically for browsers.This could be easily implemented for
time
though, with the help ofperformance.now()
, even without pulling inweb-sys
.With the current API this can't be done because
std::time::Instant
can't be constructed in any way.The solution would be to not expose
std::time::Instant
intime::Instant
and instead just provideinto()
oras_ref()
methods that are disabled on wasm. The big problem here is of course the breaking change.I know this is probably way out there but still wanted to leave this here just in case.