Closed CollinDietz closed 10 months ago
https://github.com/fzyzcjy/flutter_rust_bridge/blob/b585ab532c078af5151f7160e4efc398437ac02c/frb_example/pure_dart/rust/src/api.rs#L695 shows that we can mirror a enum, but yes it is only used within a struct
#[frb(mirror(ApplicationMode))]
pub enum _ApplicationMode {
Standalone,
Embedded,
}
Thus I suspect this may be a missing feature. Feel free to PR! (The implementation may not be super hard because we can somehow follow existing code for struct etc)
New-ish to rust and all of this, can you point me to the pieces of implementation to reference?
Sure, the first step may be https://cjycode.com/flutter_rust_bridge/contributing/design.html
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
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
I cannot mirror an external enum to flutter by returning it from a function unless it is be used as a value in a struct.
Minimum reproducible example: bug.zip Just unzip and run / look at
run_me.sh
native/src/api.rs:33-35 are the lines that cause the failure, commenting them out makes it all happy
Note: I don't see any barfing until I run
cargo build
inside of native/, which might be incorrect? But I would expect the rust lib to be buildable after code genCodegen logs with
RUST_LOG=debug
environment variableTo Reproduce
SomeEnum
)SomeStruct
)() -> SomeStruct
)() -> SomeEnum
)Expected behavior
External enums should be mirror-able to flutter without needing to be stored inside of a struct
Generated binding code
bridge_generated.dart
Version of
clang++
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Version of
ffigen
8.0.2
Additional context
Globally installed Cargo packages