Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add send sync for CF worker #175

Merged
merged 1 commit into from
Jan 13, 2025
Merged

Conversation

ronaldslc
Copy link
Contributor

This enables rig to work on CF workers which opens up a whole new dimension of use case to integrate with web based UI such as leptos.

The simple change is put behind a feature flag.

@ronaldslc ronaldslc changed the title add send sync for CF worker feat: add send sync for CF worker Dec 31, 2024
@cvauclair
Copy link
Contributor

Hey @ronaldslc, thanks for the contribution!

Quick question to make sure I understand correctly: Does that new feature flag enable Rig to be compiled to WASM in any context? Or only within the context of CF workers?

@ronaldslc
Copy link
Contributor Author

Hi @cvauclair, that's a good question, the feature flag is intended to allow rig to work with CF workers only using axum support for CF workers.

More specifically the macro was added in CF worker-rs crate due to this issue cloudflare/workers-rs#485

My understanding is JsFuture is !send in wasm_bindgen, so when rig.rs async functions are converted to wasm, the structure is not send, but axum and many frameworks requires send futures, which creates an intermediate compilation issue. So I would say this is a compatibility layer to have certain wasm compatible Rust framework, work with rig.rs. Not necessarily worker specific.

Best regards

@cvauclair
Copy link
Contributor

cvauclair commented Jan 13, 2025

Thanks for the reply @ronaldslc, makes a lot of sense!

We'll go ahead and merge this, but we'll do some testing on our end to see how general that feature is. Be aware, if it does end up being a general WASM compatibility layer we'll probably change the name of the feature flag to something like wasm to better reflect the capabilities of said feature flag.

Cheers!

@cvauclair cvauclair merged commit 78684c2 into 0xPlaygrounds:main Jan 13, 2025
3 of 4 checks passed
@github-actions github-actions bot mentioned this pull request Jan 13, 2025
@cvauclair cvauclair mentioned this pull request Jan 14, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants