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

Is wasm support possible? #38

Open
burmecia opened this issue Dec 20, 2018 · 3 comments
Open

Is wasm support possible? #38

burmecia opened this issue Dec 20, 2018 · 3 comments

Comments

@burmecia
Copy link

Is that possible to support wasm? I know currently libc crate doesn't support wasm yet (rust-lang/libc#1126), but since this crate only used limited number of c types (c_char, c_int and etc.). Replace them with Rust types like i8, i32 and etc, could be a possible temporary solution.

Any thoughts?

@jheyens
Copy link
Collaborator

jheyens commented Dec 20, 2018

This would be possible at the cost of platform independency. See #36 for example.

Additionally, when I last tried wasm with Rust months ago, crates required ![no_std] to properly work. lz4-sys is no_std but lz4 uses collections and IO traits.

I just looked it up and I think wasm does not require no_std, but a lot of libstd is simply unsupported.

For your specific problem, I'ld suggest doing one of two things:

  1. Wait, until libc supports wasm
  2. Refactor this crate locally and hard-code the types. I think I could guide you through that, if want to go this route.

@jheyens
Copy link
Collaborator

jheyens commented Dec 20, 2018

Alright, I just saw you did that already, awesome :-)

https://github.com/burmecia/lz4-rs

This crate needs some tidying up anyways, so I think, I'll note wasm support for a future lz4 2.0, where I am going to add stream mode and refactor the API to match alexcrichton's flate2

@burmecia
Copy link
Author

Thanks @jheyens. Yes, I've already forked and am playing around with it, hopefully will make it run in browser!

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

No branches or pull requests

2 participants