Skip to content

Commit c1a687d

Browse files
authored
feat: wasm feature (#72)
Add a new `wasm` feature with compression formats that can be compiled to webassembly.
1 parent 8be7824 commit c1a687d

File tree

7 files changed

+358
-41
lines changed

7 files changed

+358
-41
lines changed

.envrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
PATH=~/.pixi/bin:$PATH
2+
3+
watch_file pixi.lock
4+
eval "$(pixi shell-hook)"

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,4 @@ jobs:
171171

172172
- name: Build on wasm
173173
run: |
174-
cargo build --target wasm32-unknown-unknown --no-default-features --features gz
174+
cargo build --target wasm32-unknown-unknown --no-default-features --features wasm

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ gz = ["flate2"]
1919
bgz = ["bgzip"]
2020
xz = ["lzma"]
2121
zstd = ["dep:zstd"]
22+
wasm = ["zstd", "lzma", "gz", "bgz"]
2223

2324
# bzip2 feature transitivity
2425
bz2_tokio = ["bzip2/tokio"]
@@ -37,7 +38,6 @@ gz_rust_backend = ["flate2/rust_backend"]
3738
# xz feature transitivity
3839
xz_tokio = ["liblzma/tokio"]
3940

40-
4141
[dependencies]
4242
cfg-if = "1.0"
4343
thiserror = "2.0"

pixi.lock

+342-36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

+7
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,18 @@ platforms = ["linux-64", "linux-aarch64", "osx-64", "osx-arm64", "win-64"]
1111
[environments]
1212
default = { features = ["dev", "build"], solve-group="default" }
1313
dev = { features = ["dev", "build"], solve-group = "default" }
14+
wasm = { features = ["dev", "build", "wasm"], solve-group = "default" }
1415
msrv = { features = ["msrv", "build"], solve-group = "msrv" }
1516

1617
[feature.msrv.dependencies]
1718
rust = "~=1.74.0"
1819

20+
[feature.wasm.dependencies]
21+
rust-std-wasm32-unknown-unknown = "*"
22+
23+
[feature.wasm.tasks]
24+
build-wasm = "cargo build --target wasm32-unknown-unknown --no-default-features --features wasm"
25+
1926
[feature.msrv.tasks]
2027
check_msrv = "cargo build"
2128

src/basic/compression.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub(crate) fn bytes2type(bytes: [u8; 5]) -> Format {
4040

4141
cfg_if! {
4242
if #[cfg(feature = "gz")] {
43-
pub(crate) fn new_gz_encoder<'a>(out: Box<dyn io::Write + 'a>, level: Level) -> Result<Box<dyn io::Write + 'a>, Error> {
43+
pub(crate) fn new_gz_encoder<'a>(out: Box<dyn io::Write + 'a>, level: Level) -> Result<Box<dyn io::Write + 'a>, Error> {
4444
Ok(Box::new(flate2::write::GzEncoder::new(
4545
out,
4646
level.into(),

0 commit comments

Comments
 (0)