-
Notifications
You must be signed in to change notification settings - Fork 289
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
Generate code for Default
trait's functions
#2331
Comments
IIRC we disable by default when the traits satisfies some condition (third party?) for sanity reasons. Try to put an empty (We should have better doc for that!) |
Default
trait's functions
Oh there seems already have doc: https://cjycode.com/flutter_rust_bridge/guides/traits/implementations
|
Ah, super :) But it doesn't work for me ... maybe because of the In the doc, did you mean impl MyTrait for MyStruct {
#[frb] // marker to have this translated to dart
fn f(&self, a: String) -> i32 { ... }
} instead of impl MyTrait for MyStruct {
fn f(&self, a: String) -> i32 { ... }
} ? |
Hmm... Firstly, the workaround is to make another function (that calls this trait method). Secondly, feel free to debug and fix it! I am happy to provide hints if you like.
If it is a custom trait (unlike Default etc) then it already works, without any extra |
Is your feature request related to a problem? Please describe.
In the following struct I implemented Default:
While there is a constructor
There is no
default()
method available. Asitems
isRustAutoOpaque
I can't initialize it on the Dart side (VecString
).Describe the solution you'd like
Translating the
default()
function from the Trait to a Dart call as well. If possible doing so for all trait functions.Describe alternatives you've considered
I am currently figuring out how I can do this without a
default()
call :)Additional context
The text was updated successfully, but these errors were encountered: