-
Notifications
You must be signed in to change notification settings - Fork 114
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
zstd-sys: impl wasm32-unknown-unknown support #139
Conversation
Hi, and thanks for the work! I think without This means that the bindings file needs to depend on this. In practice, the Rather than adding yet another dimension to the selection of the bindings file, we could split this bindings into the main zstd part and the dict part, and include each file conditionally. I pushed something like that to the bindings_split branch if you want to have a look. We may also want to forward this dict_builder feature from |
Yes, it would be nice to split them. Thanks for your quick work. |
e7a7c98
to
fe55976
Compare
Looking good! One last thing: we'll want to add We'll also want to conditionally hide the relevant types in these crates depending on this feature. |
examples/train.rs
Outdated
#[cfg(feature = "zdict_builder")] | ||
{ | ||
let dict = zstd::dict::from_files(&files, size).unwrap(); | ||
|
||
let mut dict_reader: &[u8] = &dict; | ||
io::copy(&mut dict_reader, &mut io::stdout()).unwrap(); | ||
let mut dict_reader: &[u8] = &dict; | ||
io::copy(&mut dict_reader, &mut io::stdout()).unwrap(); | ||
} |
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.
You can specify that an example requires some features. In Cargo.toml
:
[[example]]
name = "train"
required-features = ["zdict_builder"]
This way, in the example itself, you can just assume the feature is set.
Thanks again for the work! |
inspired by zstd-rs (gyscos/zstd-rs#139)
This PR adds a simple wasm shim to
zstd-sys
to supportwasm32-unknown-unknown
arch.The
legacy
anddict_builder
cannot be compiled on this shim because they depend onstdio.h
, so I added a new feature cfg to turning offdict_builder
code.You can test it with
wasmtime