Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ futures = "0.3" # so the doctest for wrap_stream is nice
pretty_assertions = "1.4.0"

[target.'cfg(target_arch = "wasm32")'.dependencies]
web-time = "1.1.0"
web-time = { version = "1.1.0", optional = true }

[features]
default = ["unicode-width", "console/unicode-width"]
default = ["unicode-width", "console/unicode-width", "wasmbind"]
improved_unicode = ["unicode-segmentation", "unicode-width", "console/unicode-width"]
in_memory = ["vt100"]
futures = ["dep:futures-core"]
wasmbind = ["dep:web-time"]

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion src/draw_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::time::Duration;
use std::time::Instant;

use console::{Term, TermTarget};
#[cfg(target_arch = "wasm32")]
#[cfg(all(target_arch = "wasm32", feature = "wasmbind"))]
use web_time::Instant;

use crate::multi::{MultiProgressAlignment, MultiState};
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@
#![cfg_attr(docsrs, feature(doc_cfg))]
#![warn(unreachable_pub)]

#[cfg(all(target_arch = "wasm32", not(feature = "wasmbind")))]
compile_error!("The 'wasmbind' feature must be enabled when compiling for wasm32.");

mod draw_target;
mod format;
#[cfg(feature = "in_memory")]
Expand Down
2 changes: 1 addition & 1 deletion src/multi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::draw_target::{
VisualLines,
};
use crate::progress_bar::ProgressBar;
#[cfg(target_arch = "wasm32")]
#[cfg(all(target_arch = "wasm32", feature = "wasmbind"))]
use web_time::Instant;

/// Manages multiple progress bars from different threads
Expand Down
2 changes: 1 addition & 1 deletion src/progress_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{fmt, io, thread};

#[cfg(test)]
use once_cell::sync::Lazy;
#[cfg(target_arch = "wasm32")]
#[cfg(all(target_arch = "wasm32", feature = "wasmbind"))]
use web_time::Instant;

use crate::draw_target::ProgressDrawTarget;
Expand Down
2 changes: 1 addition & 1 deletion src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::time::Duration;
use std::time::Instant;

use portable_atomic::{AtomicU64, AtomicU8, Ordering};
#[cfg(target_arch = "wasm32")]
#[cfg(all(target_arch = "wasm32", feature = "wasmbind"))]
use web_time::Instant;

use crate::draw_target::{LineType, ProgressDrawTarget};
Expand Down
2 changes: 1 addition & 1 deletion src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use unicode_width::UnicodeWidthChar;
use console::{measure_text_width, AnsiCodeIterator, Style};
#[cfg(feature = "unicode-segmentation")]
use unicode_segmentation::UnicodeSegmentation;
#[cfg(target_arch = "wasm32")]
#[cfg(all(target_arch = "wasm32", feature = "wasmbind"))]
use web_time::Instant;

use crate::draw_target::LineType;
Expand Down