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

#[napi(constructor)] | ^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument #2111

Open
LittleTung opened this issue May 15, 2024 · 1 comment
Open

Comments

@LittleTung
Copy link

error[E0107]: method takes 1 generic argument but 2 generic arguments were supplied
--> adapter/desktop-glue/src/js_account.rs:8:1
|
8 | #[napi(constructor)]
| ^^^^^^^^^^^^^^^^^^^^ expected 1 generic argument
9 | #[derive(Serialize, Deserialize, Default, Debug)]
10 | pub struct JsAccount {
| --------- help: remove this generic argument
|
note: method defined here, with 1 generic parameter: T
--> /Users/cddengcong/.cargo/registry/src/index.crates.io-6f17d22bba15001f/napi-2.14.1/src/bindgen_runtime/callback_info.rs:121:10
|
121 | pub fn construct<T: ObjectFinalize + 'static>(
| ^^^^^^^^^ -
= note: this error originates in the attribute macro napi (in Nightly builds, run with -Z macro-backtrace for more info)

@LittleTung
Copy link
Author

LittleTung commented May 15, 2024

#[napi]
#[derive(Serialize, Deserialize, Default, Debug)]
pub struct JsAccount {
pub app: String,
pub pin: String,
}

#[napi]
impl JsAccount {
#[napi(constructor)]
pub fn new(app: String, pin: String) -> Self {
JsAccount { app: app, pin: pin }
}
}

still not work
error information: method takes 1 generic argument but 2 generic arguments were supplied
expected 1 generic argument

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant