console-rs / indicatif

A command line progress reporting library for Rust
MIT License
4.45k stars 243 forks source link

Replace `instant` with `web-time` #666

Closed torokati44 closed 1 week ago

torokati44 commented 1 week ago

Fixes https://github.com/console-rs/indicatif/issues/665. See: https://crates.io/crates/web-time.

Note that unlike instant, web-time falls back to std::time on non-WASM, so this kind of conditional exports are not really necessary:

#[cfg(not(target_arch = "wasm32"))]
use std::time::Instant;
#[cfg(target_arch = "wasm32")]
use web_time::Instant;

Instead, it could unconditionally be web_time::Instant, if making web-time a (really light, to be fair) dependency on non-WASM platforms as well is acceptable. I can update the PR accordingly, if desired.

torokati44 commented 1 week ago

Thank you for the quick merge! As with every PR - and especially ones motivated by issues downstream -, I'd highly appreciate a new release on crates.io as soon after merging as possible. ☺️

djc commented 1 week ago

@torokati44 see #667.