Closed dbsxdbsx closed 2 weeks ago
I am not sure whether the error is caused by the functions you present (possibly also by combination with usage somewhere else).
As for why sometimes RustAutoOpaque is needed, this is usually because of Rust's rules. For example, if you want A
or Option<A>
or Vec<A>
as argument of a function, then you have no choice but to own the instance of A
. That means you will never be able to use that same instance anywhere else. But if RustAutoOpaque<A>
, then it is as if Arc<A>
and thus shared ownership, and no problem.
so, that means there is no need to modify the return type of any rust fn, there should be someplace elsewhere triggered the running panic.
I guess so
Close since this seems to be solved, but feel free to reopen if you have any questions!
Close since this seems to be solved, but feel free to reopen if you have any questions!
Oh, I almost forgot about this issue. But I did fall into the "pitfall" since I still don't get it right---it just made me feel like I was somehow debugging a memory issue coding with C++(I almost rewrote the issuable code(for both Dart and Rust) from scratch, but not put it right, though).
Hmm, feel free to discuss if there is anything flutter_rust_bridge going wrong!
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.
win10, frb 2.4.0 Similar to this issue still, it is hard to diagnose to the real place trigger it. Anyway, finally, I find it is due to this dart code:
the correspding rust code:
why I am sure this fn is the core issue part? Because when replacing the
media::init_all_cms_media_docs(cms_list, number, target_media_type)...
part intovec![]
, the issue disappeared.Here, the
MediaDoc
is defined like this :the
#[frb(opaque)]
is essential, otherwise, the generation would be failed with an ambiguity warning. Then, I tried to fix it:But still, the issue is still there.
Actually, for this issue, I would rather this likely issue could be fixed totally so that users never need to care about
RustAutoOpaque