Closed Tienisto closed 2 weeks ago
Yes, looks like this combination of features is not supported yet (feel free to PR! alternatively I may implement this feature later). But the following are supported:
Option<MyOpaqueType>
Option<RustAutoOpaque<MyOpaqueType>>
Option<NonOpaqueType>
(which does not need to have &
since non-opaque types are always copied)Anyway, &MyOpaqueType
is just syntax sugar of "RustAutoOpaque<MyOpaqueType>
+ (fancily) borrow it", so I guess using Option<RustAutoOpaque<MyOpaqueType>>
may not be a big problem.
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 followed the docs in https://cjycode.com/flutter_rust_bridge/guides/types/arbitrary/rust-auto-opaque/overview and created an optional argument:
However, the generated code doesn't compile in Rust:
In a real world example where I came across this issue, I've found a workaround by writing a method for the struct that calls the actual function: https://github.com/Tienisto/rhttp/commit/efec498ae0342d2540b1c1959bb0b2f9a02f2785
Steps to reproduce
Logs
Expected behavior
No response
Generated binding code
No response
OS
No response
Version of
flutter_rust_bridge_codegen
2.3.0
Flutter info
No response
Version of
clang++
No response
Additional context
I've created https://github.com/Tienisto/frb-optional-opaque-argument to reproduce the error but the example above should also work