Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging Rust code #65

Open
MGlolenstine opened this issue Apr 20, 2022 · 4 comments
Open

Debugging Rust code #65

MGlolenstine opened this issue Apr 20, 2022 · 4 comments

Comments

@MGlolenstine
Copy link
Collaborator

Is there a way to debug both Rust and Dart code at the same time?

Rust, for example does support FFI debugging when it's loading in a native library.
I'm wondering what has to be done to enable the Rust debugging while Dart/Flutter project is running.

@thlorenz
Copy link
Owner

I do not think this is possible as the rust code is loaded via a lib into the flutter app.
The only thing I could imagine is to make it easy to leverage the rust code directly via an app that behaves like the flutter app, but is authored in rust as well.
Maybe this could be achieved via the bevy library? In any case it'd be quite a task to implement.
For now I'd recommend unit testing the rust code instead and debugging the running tests if needed.

@MGlolenstine
Copy link
Collaborator Author

That's what I went with in the end. I also implemented a logging "framework" that sends data to Dart for printing them out to the console.

While I do love working with Rust and Flutter, I'm happy that the RID part is over. Looking back, it's bitter sweet experience, great on one hand, but then a bug would cause me to lose a day.
Most of the bugs were present in code that was unable to be unit tested and I spent most time on those bugs.
Now that I'm through that, it's been smooth sailing.

(Not going to mention that I spawned few isolates and spent about a week debugging why store wasn't updating... (It's because each isolate spawned its own Store, which kinda worked, but not really.))

I really appreciate RID, as it saved us tons of time and effort that would've gone into porting our Rust lib to Dart.

@thlorenz
Copy link
Owner

Sorry you ran into these issues.
I'd love to see a blog post about your experience esp. how you overcame some challenges.

Does this mean you won't reach for rid in the future? You could also include that in the post so others can make a good decision for themselves.
I do realize that working with two techs in one project that are held together via FFI can be challenging.

@MGlolenstine
Copy link
Collaborator Author

I will reach for RID in the future, just not for a project this massive.
Now that I know its quirks, it'll be much easier to use.

About the blog.
I was thinking of starting one for ages, and now is as good time as any.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants