Methods aren't being generated for structs declared at the api root
jquesada2016 opened this issue · comments
Describe the bug
If I put a struct at the root of the api, i.e. src/api/mod.rs
, structs are converted to classes, but no methods are added to them.
struct MyStruct {}
impl MyStruct {
#[frb(sync)]
pub fn do_it(&self) {}
}
The class MyStruct
is generated, but with no methods. This behavior is the same whether the struct is opaque or not.
If I move the struct anywhere else in the api sub-module, it then works.
Steps to reproduce
- Copy the above example into
src/api/mod.rs
- Generate the code
- Observe the lack of methods
- Move the example to
src/api/works.rs
- Generate the code
- Observe it now works
Logs
N/A
Expected behavior
No response
Generated binding code
No response
OS
No response
Version of flutter_rust_bridge_codegen
No response
Flutter info
No response
Version of clang++
No response
Additional context
No response
Good observation, that looks like a bug, but the workaround is to try to put it at non-mod.rs. I may look at it later to see whether there is an easy fix.
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.