Open Zhou-Pixel opened 2 months ago
Hi! Thanks for opening your first issue here! :smile:
Hmm that's weird. Could you please firstly make a minimal reproducible sample? For example,
Error
as much as possibleWild guess: is it possible snafu somehow notice DatabaseError
and generate some code with name Database
, which then confuses frb since there is another "Database" struct there?
To check this, try to firstly rename everything into unrelated names, such as "DatabaseError -> OneError", "Database -> Two", etc
Wild guess: is it possible snafu somehow notice
DatabaseError
and generate some code with nameDatabase
, which then confuses frb since there is another "Database" struct there?To check this, try to firstly rename everything into unrelated names, such as "DatabaseError -> OneError", "Database -> Two", etc
Yeah, DatabaseError
-> MyDatabaseError
is ok. snafu do generate a struct named Database
, but I think they are different and should be recognized. Their full names are pub(crate) crate::api::error::builder::Database
and pub crate::api::profile::Database
.
Another solution is to putting the snafu's Error
and my Database
declaration in the same mod
my example: https://github.com/Zhou-Pixel/test_error.git
Wild guess: is it possible snafu somehow notice
DatabaseError
and generate some code with nameDatabase
, which then confuses frb since there is another "Database" struct there?To check this, try to firstly rename everything into unrelated names, such as "DatabaseError -> OneError", "Database -> Two", etc
One thing that confuses me is that when I write them in the same file, it works, but when I separate them, it doesn't work
I think they are different and should be recognized.
Currently this is not implemented, because it is nontrivial to correctly understand all those prefixes. For example, you need to understand use a::b::C
, use a::*
, pub use a::b::*
(which then exports everything inside b into its current mod), etc.
he snafu's
Error
and myDatabase
declaration in the same mod
But the Database snafu generated is pub(crate)
, it means I don't want to expose it to dart. Only one struct named Database is pub
. is that implemented?
Due to compatibility reasons, first-party pub(crate)
structs are also scanned and considered. Therefore, before we release 3.x version, maybe it is good to keep it unchanged...
Describe the bug
error.rs
profile.rs
Steps to reproduce
It is OK to write two pieces of code in the same file, but it is not OK to write them separately.
Logs
Expected behavior
No response
Generated binding code
No response
OS
Linux zhou-ser 6.10.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 12 Sep 2024 17:21:02 +0000 x86_64 GNU/Linux
Version of
flutter_rust_bridge_codegen
flutter_rust_bridge_codegen 2.4.0
Flutter info
Version of
clang++
clang version 18.1.8
Additional context
No response