-
-
Notifications
You must be signed in to change notification settings - Fork 133
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(wasm-support): add wasm support #351
feat(wasm-support): add wasm support #351
Conversation
…jAtDevolution/russh-1 into support-wasm-crypto-vec
commit 686cd89 Author: irving ou <jou@devolutions.net> Date: Fri Sep 20 09:29:24 2024 -0400 update cargo.toml commit 25c0847 Author: irving ou <jou@devolutions.net> Date: Thu Sep 19 14:54:43 2024 -0400 Update time.rs commit 0d7ad5c Author: irving ou <jou@devolutions.net> Date: Thu Sep 19 14:51:45 2024 -0400 fmt commit c9667a6 Author: irving ou <jou@devolutions.net> Date: Thu Sep 19 14:50:56 2024 -0400 allow dead code commit e1e9e8c Author: irving ou <jou@devolutions.net> Date: Thu Sep 19 14:45:38 2024 -0400 Create runtime.rs commit 77bea62 Author: irving ou <jou@devolutions.net> Date: Thu Sep 19 14:45:03 2024 -0400 Add comments commit 2cf485c Author: irving ou <jou@devolutions.net> Date: Thu Sep 19 14:44:03 2024 -0400 feat(wasm): Add util creates for runtime,future and time primitives for wasm
russh-util/src/runtime.rs
Outdated
#[derive(Debug)] | ||
pub struct JoinError { | ||
#[cfg(not(target_arch = "wasm32"))] | ||
inner: tokio::task::JoinError, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that the current approach with JoinHandle
seems to align with your preference. However, I’d like to propose a discussion on possibly using a one-shot channel as a unified simulation for the handle across targets. This would significantly reduce the code complexity and maintain a consistent type between WASM and non-WASM environments. By doing so, we could simplify the overall implementation while still achieving the desired functionality.
Thank you for your work! I've added some changes:
If all looks good to you, this PR is good to go |
@Eugeny Yes, LGTM! Thank you very much |
@all-contributors add @irvingoujAtDevolution for code |
I've put up a pull request to add @irvingoujAtDevolution! 🎉 |
Adds @irvingoujAtDevolution as a contributor for code. This was requested by Eugeny [in this comment](#351 (comment)) [skip ci] --------- Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
This reverts commit d03df31.
Hi @Eugeny,
As mentioned in the previous pull request, it seems like you would prefer a complete PR for the entire integration. Hence, I have merged the previous two pull requests into one, containing the full integration. Please take a look!
Key Changes:
russh-util
crate, and sealed the runtime with conditional compilation: Tokio for non-WASM, and wasm-bindgen for WASM.russh-util
: using std::time for non-WASM, and chrono for WASM.cryptovec
, encapsulating the differences formemset
,memcpy
,mlock
, andmunlock
into separate files, gated behind feature flags.server
module from compiling for WASM. If anyone needs it in the future, they can follow a similar approach to the one I used.known_hosts
module and gated it behind a compilation flag, as the WASM environment typically lacks a file system.server
-specificcfg
andcfg_attr
attributes to handle platform differences in usage.Let me know if any further modifications are needed!