Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions web-async/src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ impl<T> Clone for Lock<T> {
}
}

impl<T: fmt::Debug> fmt::Debug for Lock<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.inner.fmt(f)
}
}

pub struct LockGuard<'a, T> {
#[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))]
inner: parking_lot::MutexGuard<'a, T>,
Expand Down
18 changes: 0 additions & 18 deletions web-async/src/spawn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,10 @@ pub fn spawn<F: Future<Output = ()> + Send + 'static>(f: F) {
tokio::task::spawn(f);
}

#[cfg(any(not(target_arch = "wasm32"), target_os = "wasi"))]
#[track_caller]
pub fn spawn_named<F: Future<Output = ()> + Send + 'static>(name: &str, f: F) {
#[cfg(feature = "tracing")]
let f = tracing::Instrument::in_current_span(f);
tokio::task::Builder::new().name(name).spawn(f).ok();
}

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[track_caller]
pub fn spawn<F: Future<Output = ()> + 'static>(f: F) {
#[cfg(feature = "tracing")]
let f = tracing::Instrument::in_current_span(f);
wasm_bindgen_futures::spawn_local(f);
}

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#[track_caller]
pub fn spawn_named<F: Future<Output = ()> + 'static>(name: &str, f: F) {
// WASM doesn't support task names, just spawn normally
#[cfg(feature = "tracing")]
let f = tracing::Instrument::in_current_span(f);
let _ = name; // Suppress unused warning
wasm_bindgen_futures::spawn_local(f);
}