fzyzcjy / flutter_rust_bridge

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

Fix return for struct with methods #594

Closed Zaitam closed 1 year ago

Zaitam commented 1 year ago

Related to #587

Close #585

Previous discussions: #585

Checklist

welcome[bot] commented 1 year ago

Hi! Thanks for opening this pull request! :smile:

Zaitam commented 1 year ago

@fzyzcjy If you can review the changes. They are basic (+6 lines, which aren't even lines) but I think this is what you meant to do

fzyzcjy commented 1 year ago

Good job.

  • [ ] New tests are added to ensure new features are working (probably by modifying the frb_example/pure_dart example).

Seems that this task has not been finished :)

fzyzcjy commented 1 year ago

CI fails 👀

Maybe you need to run the code generator locally and commit changes here

lattice0 commented 1 year ago

Thanks for the help Zaitam!

Zaitam commented 1 year ago

Yeah sorry I took a few days off and can't fix it atm. I'll do it as soon as I can

fzyzcjy commented 1 year ago

Take your time!

fzyzcjy commented 1 year ago

/cc @lattice0 for reviews as well - since he made the previous fix :)

Zaitam commented 1 year ago

@fzyzcjy, so I fixed the merge conflicts. I think the changes are done. Sorry if it took me long to update it, had other stuff. I skipped the 'add changes to book' bc this is already explained (Not this particular use case) But in vectors and arrays

fzyzcjy commented 1 year ago

Good job and take your time! I will review it in a minute.

fzyzcjy commented 1 year ago

@all-contributors please add @Zaitam for code

allcontributors[bot] commented 1 year ago

@fzyzcjy

I've put up a pull request to add @Zaitam! :tada:

Zaitam commented 1 year ago

Hey so I don't get the errors for the:

The ones of the code linting are clear and easy. If u could explain any of them so I can fix it

fzyzcjy commented 1 year ago

for "run codegen" -- run code generator locally, and commit them.

for valgrind, check its log output

Zaitam commented 1 year ago

So... The 3 issues (macos-11, windows-2019, ubuntu-20.04) are bc I need to run all of these folders test's locally?

fzyzcjy commented 1 year ago

Look at its log (e.g. https://github.com/fzyzcjy/flutter_rust_bridge/runs/8104588993?check_suite_focus=true) to see what is happening :)

fzyzcjy commented 1 year ago

Wait a bit... https://github.com/fzyzcjy/flutter_rust_bridge/runs/8107781203?check_suite_focus=true CI is failing even for master branch, which was working well!

So, no worries about the CI before #655 is fixed :)

Sadly I cannot merge this PR until #655 is fixed, because as is widely recognized, we should merge when CI goes green.

fzyzcjy commented 1 year ago

👀 What happened @Zaitam

Zaitam commented 1 year ago

I was too behind in the commits so decided to delete the fork and start from 0. There were too many edits to the src/generator/dart/mod.rs that I got lost just by looking at it... Btw, how can I use the just cli to test the bridge?

fzyzcjy commented 1 year ago

I see, totally agree :)

Btw, how can I use the just cli to test the bridge?

Run codegen? just gen-bridge

fzyzcjy commented 1 year ago

just refresh_all may also help

Zaitam commented 1 year ago

error[E0658]: use of unstable library feature 'bool_to_option' it is in .then_some any ideas? (Clean copy of latest master version)

fzyzcjy commented 1 year ago

https://github.com/fzyzcjy/flutter_rust_bridge/commit/bdb7f11b5c8a5487355daac078d1166f657558f3

/cc @Desdaemon maybe your recent PR introduces non-stable feature?

Desdaemon commented 1 year ago

I think it was the recently stabilized then_some method in 1.64.

Zaitam commented 1 year ago

@fzyzcjy I didn't have much time to do it in the last days. I do confirm it was a rust problem, but I am also getting some flutter issues bc of I am unable to downgrade... Anyhow, i've been looking at the ty_something.rs files and say that the self class contained ir, context, etc. But couldn't find how to use ty.dart_param_type() similar to the use in the generate_wire2api_func function. Is it included in the self?

fzyzcjy commented 1 year ago

@Zaitam Maybe dig a bit into the source code and mimic other usages? This may help as well: http://cjycode.com/flutter_rust_bridge/contributing/design.html