Skip to content

Commit d5df877

Browse files
committed
fixing serde and libflate
1 parent 840c819 commit d5df877

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,22 @@ prost = "0.12"
2828
prost-types = "0.12"
2929
reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] }
3030
serde_json = "1"
31-
serde = { version = "1", features = ["derive"] }
31+
serde = "1"
3232
sha2 = "0.10"
3333
tracing = "0.1"
3434
tracing-futures = { version = "0.2.5", default-features = false, features = ["futures-03", "std"] }
3535
uuid = { version = "1.7", features = ["v4", "js"] } # A library to generate and parse UUIDs.
36+
wasm-bindgen = { version = "0.2.68", features = ["serde-serialize"] }
3637
wasm-bindgen-futures = "0.4.18"
3738

38-
# Non-feature optional dependencies
39-
libflate = { version = "2", optional = true }
40-
4139
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
40+
serde = { version = "1", features = ["derive"] }
4241
tonic = "0.10"
4342
tokio = { version = "1", features = ["full"] }
4443

44+
# Non-feature optional dependencies
45+
libflate = { version = "2", optional = true }
46+
4547
[build-dependencies]
4648
async-std = { version = "1", default-features = false, features = ["default", "tokio1"] }
4749
cfg-if = "1.0.0"

src/compression.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#[cfg(feature = "compression")]
1+
#[cfg(all(feature = "compression", not(target_arch = "wasm32")))]
22
use libflate::gzip;
33

4-
#[cfg(feature = "compression")]
4+
#[cfg(all(feature = "compression", not(target_arch = "wasm32")))]
55
const TARGET_LOG_COMPRESSION: &str = "apollo-studio-extension-compression";
66

7-
#[cfg(feature = "compression")]
7+
#[cfg(all(feature = "compression", not(target_arch = "wasm32")))]
88
pub fn compress(msg: Vec<u8>) -> Result<Vec<u8>, std::io::Error> {
99
let mut encoder = gzip::Encoder::new(Vec::new()).unwrap();
1010
let mut msg = std::io::Cursor::new(msg);
@@ -20,7 +20,7 @@ pub fn compress(msg: Vec<u8>) -> Result<Vec<u8>, std::io::Error> {
2020
encoder.finish().into_result()
2121
}
2222

23-
#[cfg(not(feature = "compression"))]
23+
#[cfg(any(not(feature = "compression"), target_arch = "wasm32"))]
2424
pub fn compress(msg: Vec<u8>) -> Result<Vec<u8>, std::io::Error> {
2525
Ok::<Vec<u8>, std::io::Error>(msg)
2626
}

0 commit comments

Comments
 (0)