-
Notifications
You must be signed in to change notification settings - Fork 223
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
Add Send trait bounds to the Futures #185
Conversation
Does it limit ability to use rust-websocket with non-sendable underlying connection while single-threaded? |
@vi It does indeed. However I have yet to find any connection in the wild that isn't |
The ideal solution is not to use a |
Non- |
On the other hand, right now it's impossible to use this library both in a multithreaded context and in a single-threaded context with the latest version of tokio. |
Will it stay that way with Tokio reform done? |
One of the hacks that can be done is to let users to choose "Provide Send, but requre Send" or "Not provide Send, not require Send" as Cargo feature (like |
Using a feature is bad idea, because if a user pulls the websocket library once without the feature and once with the feature, then the feature will be enabled even on the side where it wasn't. In other words, code that compiles with a feature disabled should always keep compiling with that feature enabled. |
This change is "post tokio reform". You can consider it part of the reform. |
Shall Mutex-denial users use
hack? (like I use in my project) It starts feeling that although theoretically one can use do Futures without Send with current_thread runtime, in reality it not ecosystem-supported (like no_std - you can do no_std, but most dependencies bring in std)... |
@vi You might want to consider https://crates.io/crates/send_wrapper as a safe alternative to |
Primary authors and maintainers (@cyderize, @illegalprime) inactivity watchdog is expired, so I'm going to start releasing rust-websocket versions with some pull requests merged myself, soon-ish. Does this pull request grant a minor version (0.20.4) or better to be safe and bump it to 0.21.0? |
Published |
That should be 0.21 strictly speaking, as there is a new trait bound requirement. |
Tokio's executor trait requires
Send
to be implemented on the future to be spawned.