workers-rs icon indicating copy to clipboard operation
workers-rs copied to clipboard

breaking change: Remove worker::send entirely

Open guybedford opened this issue 2 months ago • 4 comments

Mulling this one over as an alternative to https://github.com/cloudflare/workers-rs/pull/784.

This uses a new wasm bindgen feature for unsafe-single-threaded-traits which just makes everything Sync and Send for us under the single-threaded assumption.

Would simplify things not having to have this noise in Rust Workers codebase.

guybedford avatar Oct 30 '25 19:10 guybedford

Ahh, found the failures here - I see this is because of Axum.

guybedford avatar Oct 30 '25 19:10 guybedford

Cases like leptos ssr do want server functions to return a future that is Send, this (the send module) become useful when downstream users needs to make futures Send in workers environment, especially like the JsFuture type.

It might not be a great example of usage, but I am using it in my website.

WERDXZ avatar Oct 30 '25 20:10 WERDXZ

I've updated this PR to use an experimental wasm bindgen feature for this in https://github.com/wasm-bindgen/wasm-bindgen/pull/4770, and this approach seems to work now.

guybedford avatar Oct 30 '25 21:10 guybedford

All tests are passing - CI failure here is due to the examples build not using the forked wasm bindgen worker-build.

guybedford avatar Oct 30 '25 21:10 guybedford