fzyzcjy / flutter_rust_bridge

Flutter/Dart <-> Rust binding generator, feature-rich, but seamless and simple.
https://fzyzcjy.github.io/flutter_rust_bridge/
MIT License
4.2k stars 289 forks source link

[Bug] Failed to parse function output type PhotonRgba #1064

Closed realcarlos closed 1 year ago

realcarlos commented 1 year ago

Describe the bug

flutter_rust_bridge_codegen --rust-input rust/src/api.rs --dart-output lib/bridge_generated.dart --llvm-path /usr/local/opt/llvm/

I could run the cmd above successfully in other project, but when I run it in "flutter_photon_rs-master", I got error like this: thread 'main' panicked at 'Failed to parse function output type PhotonRgba', /Users/xxx/.cargo/registry/src/github.com-1ecc6299db9ec823/flutter_rust_bridge_codegen-1.63.1/src/parser/mod.rs:234:25

Codegen logs with RUST_LOG=debug environment variable

configs=[Opts { rust_input_path: "/Users/xxx/Downloads/flutter_photon_rs-master/rust/src/api.rs", dart_output_path: "/Users/xxx/Downloads/flutter_photon_rs-master/lib/bridge_generated.dart", dart_decl_output_path: None, c_output_path: ["/var/folders/b1/0fd1b6hs7lz0fm_mh346lybm0000gn/T/.tmpvi4PiX.h"], rust_crate_dir: "/Users/xxx/Downloads/flutter_photon_rs-master/rust", rust_output_path: "/Users/xxx/Downloads/flutter_photon_rs-master/rust/src/bridge_generated.rs", class_name: "FlutterPhotonRs", dart_format_line_length: 80, skip_add_mod_to_lib: false, llvm_path: ["/usr/local/opt/llvm/"], llvm_compiler_opts: "", manifest_path: "/Users/xxx/Downloads/flutter_photon_rs-master/rust/Cargo.toml", dart_root: Some("/Users/xxx/Downloads/flutter_photon_rs-master"), build_runner: true, block_index: BlockIndex(0), skip_deps_check: false, wasm_enabled: false, inline_rust: false }]

To Reproduce

No response

Expected behavior

No response

Generated binding code

No response

OS

No response

Version of flutter_rust_bridge_codegen

1.63.1

Flutter info

No response

Version of clang++

No response

Version of ffigen

No response

Additional context

No response

welcome[bot] commented 1 year ago

Hi! Thanks for opening your first issue here! :smile:

realcarlos commented 1 year ago

in api.rs , an alias name is used: pub use photon_rs::Rgba as PhotonRgba;

fzyzcjy commented 1 year ago

Hmm would be great to show more logs and make a minimal reproducible sample.

Or, if you are sure it is a bug because of import alias, feel free to PR!

107295472 commented 1 year ago

@fzyzcjy Found the problem, the entity type cannot be written in other packages, only in the api package

realcarlos commented 1 year ago

@fzyzcjy Found the problem, the entity type cannot be written in other packages, only in the api package

Hi bro , would you like to create a PR to fix this issue?

realcarlos commented 1 year ago

@fzyzcjy Found the problem, the entity type cannot be written in other packages, only in the api package

Hi bro, any ideas? could you tell me what I should do?

stale[bot] commented 1 year ago

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.

github-actions[bot] commented 1 year ago

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.