wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

fix(#3297): Allow variant skip

Open erwanvivien opened this issue 1 year ago • 1 comments

Provides a way to avoid having only C-Style enums allowed with #[wasm_bindgen] by allowing user to omit an enum Variant, it's then at the user discretion to use #[cfg] directives to reflect this

Can be seen in the example:

#[wasm_bindgen]
pub enum Operation {
    INCREMENT,

    #[cfg(not(target_arch = "wasm32"))]
    #[wasm_bindgen(skip)]
    CUSTOM(fn(i32) -> i32),
}

erwanvivien avatar Jun 25 '23 09:06 erwanvivien

As discussed with Daxpedda on Discord, this is not a good idea.

erwanvivien avatar Jun 25 '23 21:06 erwanvivien