Skip to content

Commit 824a413

Browse files
authored
Fixing issue with worker on wasm targets
1 parent 3ff8d14 commit 824a413

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/worker/mod.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,18 @@ pub enum PreferWorkerKind {
3434
Multithreaded,
3535
}
3636

37+
3738
/// Execute something with a worker system.
3839
pub fn with_worker<T>(prefer: PreferWorkerKind, f: impl FnOnce(&mut dyn Worker) -> T) -> T {
40+
#[cfg(any(target_arch = "asmjs", target_arch = "wasm32"))]
41+
{
42+
return self::immediate::with_immediate(f);
43+
}
3944
match prefer {
40-
#[cfg(not(any(target_arch = "asmjs", target_arch = "wasm32")))]
4145
#[cfg(feature = "rayon")]
4246
PreferWorkerKind::Multithreaded => self::rayon::with_rayon(f),
43-
#[cfg(not(any(target_arch = "asmjs", target_arch = "wasm32")))]
4447
PreferWorkerKind::Multithreaded => self::multithreaded::with_multithreading(f),
4548
_ => self::immediate::with_immediate(f),
4649
}
4750
}
51+

0 commit comments

Comments
 (0)