From 2218f998c0f36d8f400ae003c2d643f069151e2c Mon Sep 17 00:00:00 2001 From: Toshit Chawda Date: Fri, 6 Sep 2024 20:58:15 -0700 Subject: [PATCH] ugly hack --- client/src/lib.rs | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/client/src/lib.rs b/client/src/lib.rs index 01cdfbc..d705803 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -185,18 +185,34 @@ enum EpoxyCompression { Gzip, } -#[wasm_bindgen] -pub struct EpoxyClientOptions { - pub wisp_v2: bool, - pub udp_extension_required: bool, - #[wasm_bindgen(getter_with_clone)] - pub websocket_protocols: Vec, - pub redirect_limit: usize, - #[wasm_bindgen(getter_with_clone)] - pub user_agent: String, - #[cfg(feature = "full")] - #[wasm_bindgen(getter_with_clone)] - pub pem_files: Vec, + +// ugly hack. switch to serde-wasm-bindgen or a knockoff +cfg_if! { + if #[cfg(feature = "full")] { + #[wasm_bindgen] + pub struct EpoxyClientOptions { + pub wisp_v2: bool, + pub udp_extension_required: bool, + #[wasm_bindgen(getter_with_clone)] + pub websocket_protocols: Vec, + pub redirect_limit: usize, + #[wasm_bindgen(getter_with_clone)] + pub user_agent: String, + #[wasm_bindgen(getter_with_clone)] + pub pem_files: Vec, + } + } else { + #[wasm_bindgen] + pub struct EpoxyClientOptions { + pub wisp_v2: bool, + pub udp_extension_required: bool, + #[wasm_bindgen(getter_with_clone)] + pub websocket_protocols: Vec, + pub redirect_limit: usize, + #[wasm_bindgen(getter_with_clone)] + pub user_agent: String, + } + } } #[wasm_bindgen]