Closed lomirus closed 10 months ago
Hi! Thanks for opening your first issue here! :smile:
That looks like a bug. One way may be to reproduce this / compare this with the https://github.com/fzyzcjy/flutter_rust_bridge/tree/master/frb_example/pure_dart example (since that one works well)
I cloned fzyzcjy/flutter_rust_bridge
and cd
into the pure_dart
, removed generated files and regenerated by:
flutter_rust_bridge_codegen --rust-input rust\src\api.rs --dart-output dart\lib\bridge_generated.dart --dart-decl-output dart\lib\bridge_definitions.dart --wasm
It built successfully and there seems only formatting changes.
Then I added struct Test
at the end of the api.rs
:
Then ran codegen again:
flutter_rust_bridge_codegen --rust-input rust\src\api.rs --dart-output dart\lib\bridge_generated.dart --dart-decl-output dart\lib\bridge_definitions.dart --wasm
Nothing changed. The bridge_definitions.dart
stayed the same.
Oh I see: So it seems that you never use the struct in any function? Maybe try to use them in a function (just create a function that does exactly nothing and that should be enough)
Thanks, it works now for the struct. But how about the function imported to api.rs
? For example, I created fn get_svg()
in rust/src/svg/mod.rs
, and then in rust/src/api.rs
I added:
pub use crate::svg::get_svg;
But it wasn't compiled to dart.
It seems that there's a bug in Github Issue, your last comment is earlier than mine but what it displays in fact is that my previous comment is earlier. 🤔
Thanks, it works now for the struct. But how about the function imported to
api.rs
? For example, I createdfn get_svg()
inrust/src/svg/mod.rs
, and then inrust/src/api.rs
I added:pub use crate::svg::get_svg;
But it wasn't compiled to dart.
IIRC that one is not implemented yet. Feel free to PR to fix it!
In v2, flutter_rust_bridge supports a whole folder (indeed a whole crate) as input, so this is no longer an issue. Feel free to reopen if needed!
Thanks ! 👍
You are welcome!
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.
Describe the bug
Here's the
native/src/api.rs
:Then I ran:
The output file
lib/bridge_definitions.dart
:Only
fn a()
was compiled,enum B
,struct C
,fn ithkuil_svg()
,struct Primary
etc. was not compiled to dart.Codegen logs with
RUST_LOG=debug
environment variableWhen I attemped to post this issue, the github said:
So I will omit some unnecessary logs below.
To Reproduce
See Describe the bug
Expected behavior
enum B
,struct C
,fn ithkuil_svg()
,struct Primary
etc. would be compiled to dart as thefn a()
Generated binding code
OS
Windows
Version of
flutter_rust_bridge_codegen
1.82.3
Flutter info
Version of
clang++
17.0.1
Version of
ffigen
^9.0.1
Additional context
No response