#[wasm_bindgen]
pub struct Foo{
pub bar: String,
}
got error:
the trait bound
String: std::marker::Copy
is not satisfied the traitstd::marker::Copy
is not implemented forString
#[wasm_bindgen]
pub struct Foo{
pub bar: String,
}
got error:
the trait bound
String: std::marker::Copy
is not satisfied the traitstd::marker::Copy
is not implemented forString
For cross-referencing: you also posted this as a bug here: How declare pub struct with pub fields with wasm_bindgen attribute · Issue #3417 · rustwasm/wasm-bindgen · GitHub
The error message tells you that it expects the fields to implement Copy
.
String
does not (and cannot) implement Copy
, so you cannot use that as a public field.
You should be able to implement a getter (docs) to return your string though.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.