Skip to content
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

the trait bound XXX: RefFromWasmAbi is not satisfied #4427

Open
ahaoboy opened this issue Feb 9, 2025 · 0 comments
Open

the trait bound XXX: RefFromWasmAbi is not satisfied #4427

ahaoboy opened this issue Feb 9, 2025 · 0 comments
Labels

Comments

@ahaoboy
Copy link

ahaoboy commented Feb 9, 2025

Describe the Bug

error[E0277]: the trait bound `TestEnum: RefFromWasmAbi` is not satisfied
  --> src\lib.rs:29:1
   |
29 | #[wasm_bindgen]
   | ^^^^^^^^^^^^^^^ the trait `RefFromWasmAbi` is not implemented for `TestEnum`

Steps to Reproduce

#[wasm_bindgen]
pub enum TestEnum {
    A,
    B,
}
#[wasm_bindgen]
impl TestEnum {
    pub fn log1(self) {
        println!("log1")
    }

    pub fn log2(&self) {
      println!("log2")
  }
}

Expected Behavior

Both log1 and log2 work correctly

Actual Behavior

Since log2 uses &self, it cannot be exported to wasm

It seems to be due to the limitation of js

#1715

@ahaoboy ahaoboy added the bug label Feb 9, 2025
@ahaoboy ahaoboy changed the title RefFromWasmAbi the trait bound XXX: RefFromWasmAbi is not satisfied Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant