File tree Expand file tree Collapse file tree 5 files changed +23
-13
lines changed Expand file tree Collapse file tree 5 files changed +23
-13
lines changed Original file line number Diff line number Diff line change 1- # The following is required for Wasm support in the `getrandom` crate, a transitive dependency of the `rand` crate.
2- # See: https://docs.rs/getrandom/0.3.3/getrandom/#webassembly-support
1+ # The following is required for Wasm support in the `getrandom` crate, a transitive dependency of the `time_trigger`
2+ # feature. See: https://docs.rs/getrandom/0.3.3/getrandom/#webassembly-support
33#
44# If you are using `wasm-pack`, this config may not be respected. Use an environment variable instead:
55# RUSTFLAGS='--cfg getrandom_backend="wasm_js"' wasm-pack build --target web
Original file line number Diff line number Diff line change 7474
7575 - name : Bench features
7676 run : cargo bench --all-features
77+
78+ wasm :
79+ name : Build for WebAssembly (wasm32-unknown-unknown)
80+ runs-on : ubuntu-latest
81+ steps :
82+ - name : Checkout the source code
83+ uses : actions/checkout@v4
84+
85+ - uses : dtolnay/rust-toolchain@stable
86+ with :
87+ targets : wasm32-unknown-unknown
88+
89+ - name : Build for wasm32-unknown-unknown
90+ run : cargo build --target wasm32-unknown-unknown
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ libc = { version = "0.2", optional = true }
112112[target .'cfg(not(target_family = "wasm"))' .dependencies ]
113113thread-id = { version = " 5" , optional = true }
114114
115- [target .'cfg(target_family = "wasm")' .dependencies ]
115+ [target .'cfg(all( target_family = "wasm", feature="time_trigger") )' .dependencies ]
116116getrandom = { version = " 0.3.3" , features = [" wasm_js" ], optional = true }
117117
118118
Original file line number Diff line number Diff line change @@ -640,9 +640,7 @@ impl FormattedChunk {
640640 TID . with ( |tid| w. write_all ( tid. to_string ( ) . as_bytes ( ) ) )
641641 }
642642 #[ cfg( target_family = "wasm" ) ]
643- FormattedChunk :: SystemThreadId => {
644- w. write_all ( "0" . as_bytes ( ) )
645- }
643+ FormattedChunk :: SystemThreadId => w. write_all ( "0" . as_bytes ( ) ) ,
646644 FormattedChunk :: Target => w. write_all ( record. target ( ) . as_bytes ( ) ) ,
647645 FormattedChunk :: Newline => w. write_all ( NEWLINE . as_bytes ( ) ) ,
648646 FormattedChunk :: Align ( ref chunks) => {
Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ mod imp {
237237 self ,
238238 writer:: {
239239 ansi:: AnsiWriter ,
240- console:: { ColorMode , COLOR_MODE } ,
240+ console:: { color_mode , ColorMode } ,
241241 } ,
242242 Style ,
243243 } ,
@@ -249,18 +249,16 @@ mod imp {
249249 impl Writer {
250250 pub fn stdout ( ) -> Option < Writer > {
251251 let writer = || Writer ( AnsiWriter ( StdWriter :: stdout ( ) ) ) ;
252- match * COLOR_MODE {
253- ColorMode :: Auto
254- | ColorMode :: Always => Some ( writer ( ) ) ,
252+ match color_mode ( ) {
253+ ColorMode :: Auto | ColorMode :: Always => Some ( writer ( ) ) ,
255254 ColorMode :: Never => None ,
256255 }
257256 }
258257
259258 pub fn stderr ( ) -> Option < Writer > {
260259 let writer = || Writer ( AnsiWriter ( StdWriter :: stderr ( ) ) ) ;
261- match * COLOR_MODE {
262- ColorMode :: Auto
263- | ColorMode :: Always => Some ( writer ( ) ) ,
260+ match color_mode ( ) {
261+ ColorMode :: Auto | ColorMode :: Always => Some ( writer ( ) ) ,
264262 ColorMode :: Never => None ,
265263 }
266264 }
You can’t perform that action at this time.
0 commit comments