From b344a789367d1f56195b7ea8d85df503d2df6ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=96R=C3=96K=20Attila?= Date: Sun, 10 Nov 2024 15:58:25 +0100 Subject: [PATCH] Replace `instant` with `web-time` --- Cargo.toml | 2 +- src/draw_target.rs | 2 +- src/multi.rs | 2 +- src/progress_bar.rs | 4 ++-- src/state.rs | 4 ++-- src/style.rs | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 73a865df..ddd9e513 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,7 +32,7 @@ futures = "0.3" # so the doctest for wrap_stream is nice pretty_assertions = "1.4.0" [target.'cfg(target_arch = "wasm32")'.dependencies] -instant = "0.1" +web-time = "1.1.0" [features] default = ["unicode-width", "console/unicode-width"] diff --git a/src/draw_target.rs b/src/draw_target.rs index bac1ce58..689e2f17 100644 --- a/src/draw_target.rs +++ b/src/draw_target.rs @@ -9,7 +9,7 @@ use std::time::Instant; use console::Term; #[cfg(target_arch = "wasm32")] -use instant::Instant; +use web_time::Instant; use crate::multi::{MultiProgressAlignment, MultiState}; use crate::TermLike; diff --git a/src/multi.rs b/src/multi.rs index 90327166..84edb5dd 100644 --- a/src/multi.rs +++ b/src/multi.rs @@ -10,7 +10,7 @@ use crate::draw_target::{ }; use crate::progress_bar::ProgressBar; #[cfg(target_arch = "wasm32")] -use instant::Instant; +use web_time::Instant; /// Manages multiple progress bars from different threads #[derive(Debug, Clone)] diff --git a/src/progress_bar.rs b/src/progress_bar.rs index fec1fd76..7b897d8b 100644 --- a/src/progress_bar.rs +++ b/src/progress_bar.rs @@ -7,10 +7,10 @@ use std::time::Duration; use std::time::Instant; use std::{fmt, io, thread}; -#[cfg(target_arch = "wasm32")] -use instant::Instant; #[cfg(test)] use once_cell::sync::Lazy; +#[cfg(target_arch = "wasm32")] +use web_time::Instant; use crate::draw_target::ProgressDrawTarget; use crate::state::{AtomicPosition, BarState, ProgressFinish, Reset, TabExpandedString}; diff --git a/src/state.rs b/src/state.rs index 136e2307..29bb2514 100644 --- a/src/state.rs +++ b/src/state.rs @@ -5,9 +5,9 @@ use std::time::Duration; #[cfg(not(target_arch = "wasm32"))] use std::time::Instant; -#[cfg(target_arch = "wasm32")] -use instant::Instant; use portable_atomic::{AtomicU64, AtomicU8, Ordering}; +#[cfg(target_arch = "wasm32")] +use web_time::Instant; use crate::draw_target::ProgressDrawTarget; use crate::style::ProgressStyle; diff --git a/src/style.rs b/src/style.rs index 3fbf8879..2d148a28 100644 --- a/src/style.rs +++ b/src/style.rs @@ -5,10 +5,10 @@ use std::mem; use std::time::Instant; use console::{measure_text_width, Style}; -#[cfg(target_arch = "wasm32")] -use instant::Instant; #[cfg(feature = "unicode-segmentation")] use unicode_segmentation::UnicodeSegmentation; +#[cfg(target_arch = "wasm32")] +use web_time::Instant; use crate::format::{ BinaryBytes, DecimalBytes, FormattedDuration, HumanBytes, HumanCount, HumanDuration,