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

🌐 Add WASM Support #14

Merged
merged 2 commits into from
Apr 16, 2021
Merged

🌐 Add WASM Support #14

merged 2 commits into from
Apr 16, 2021

Conversation

zicklag
Copy link
Contributor

@zicklag zicklag commented Apr 15, 2021

Still, testing, but would you be open to supporting WASM? It looks like all that is needed is an extra dep for supporting std::time::Instant on web.

It's behind a feature flag so it doesn't effect anybody unconcerned with WASM.

@zicklag
Copy link
Contributor Author

zicklag commented Apr 15, 2021

Tested on my project and it looks like it works.

@zicklag zicklag marked this pull request as ready for review April 15, 2021 01:34
Cargo.toml Outdated Show resolved Hide resolved
@zicklag zicklag force-pushed the wasm-support branch 2 times, most recently from a58b22b to d9170e7 Compare April 15, 2021 01:43
@zeenix
Copy link
Member

zeenix commented Apr 15, 2021

LGTM!

Cargo.toml Outdated Show resolved Hide resolved
@zicklag
Copy link
Contributor Author

zicklag commented Apr 15, 2021

OK, I removed instant completely and just made sure that Mutex doesn't depend on std::time when targeting WASM. I didn't technically run tests on WASM, but if you take out the same code that is excluded when running on WASM then the tests pass on native.

I also added cargo check for WASM to CI!

@zicklag zicklag requested a review from taiki-e April 15, 2021 16:30
@zicklag zicklag changed the title Add WASM Support 🌐 Add WASM Support Apr 15, 2021
@taiki-e
Copy link
Collaborator

taiki-e commented Apr 16, 2021

Thanks! I would like to run tests on CI if possible -- do you think it is possible to do something like smol-rs/fastrand#7?

@zicklag
Copy link
Contributor Author

zicklag commented Apr 16, 2021

I'll take a look at it.

@zicklag zicklag force-pushed the wasm-support branch 3 times, most recently from bd56dd5 to 3cf284e Compare April 16, 2021 14:50
@zicklag
Copy link
Contributor Author

zicklag commented Apr 16, 2021

There you go! Tests are passing for WASM in CI. Thanks for the link on how to set that up.

Copy link
Collaborator

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @zicklag!

@taiki-e taiki-e merged commit 20eb90e into smol-rs:master Apr 16, 2021
@zicklag
Copy link
Contributor Author

zicklag commented Apr 16, 2021

No problem, glad I could help! I love the simple smol ecosystem. 😃

@zicklag zicklag deleted the wasm-support branch April 16, 2021 15:11
@taiki-e taiki-e mentioned this pull request Apr 16, 2021
@taiki-e
Copy link
Collaborator

taiki-e commented Apr 16, 2021

Published in v2.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants