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.09k stars 278 forks source link

Error converting 32 byte array in new release #572

Closed charleschege closed 1 year ago

charleschege commented 2 years ago

Describe the bug

After upgrade to 1.37.2, it breaks arrays like

struct Foo {
    bar: [u8; 32]
}

compiling that produces the error from the bridge_generated.rs file:

the trait `Wire2Api<[u8; 32]>` is not implemented for `*mut wire_uint_8_list`

Codegen logs with RUST_LOG=debug environment variable

error[E0277]: the trait bound `*mut wire_uint_8_list: Wire2Api<[u8; 32]>` is not satisfied
   --> NativeUI/src/bridge_generated.rs:159:39
    |
159 |             wallet_id: self.wallet_id.wire2api(),
    |                                       ^^^^^^^^ the trait `Wire2Api<[u8; 32]>` is not implemented for `*mut wire_uint_8_list`
    |
    = help: the following other types implement trait `Wire2Api<T>`:
              <*mut wire_uint_8_list as Wire2Api<String>>
              <*mut wire_uint_8_list as Wire2Api<Vec<u8>>>

For more information about this error, try `rustc --explain E0277`.
error: could not compile `my_crate` due to previous error

To Reproduce

Create a struct with [u8; 32] as a field and call it from a function

Expected behavior

No response

Generated binding code

No response

OS

Ubuntu 20.05

Version of flutter_rust_bridge_codegen

1.37.2

Flutter info

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.4, on KDE neon User - 5.25 5.4.0-121-generic, locale en_GB.UTF-8)
Checking Android licenses is taking an unexpectedly long time...[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] VS Code (version 1.69.0)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

! Doctor found issues in 1 category.

Version of clang++

10.0.0-4ubuntu1

Version of ffigen

6.0.1

Additional context

No response

welcome[bot] commented 2 years ago

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

fzyzcjy commented 2 years ago

So, what is the last version that it worked?

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.