Skip to content

Add shorthand for &self in RustQt blocks where the type can be inferred #1249

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

Merged
merged 9 commits into from
May 21, 2025

Conversation

BenFordTytherington
Copy link
Collaborator

@BenFordTytherington BenFordTytherington commented Apr 4, 2025

Allows Pin<&mut Self> and &self inside the bridge, as shorthand.

Copy link

codecov bot commented Apr 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (1bffb6a) to head (8618301).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1249   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           73        75    +2     
  Lines        12681     12772   +91     
=========================================
+ Hits         12681     12772   +91     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@BenFordTytherington BenFordTytherington force-pushed the add-self-shorthand branch 4 times, most recently from 32371fd to e457080 Compare April 4, 2025 15:52
@BenFordTytherington BenFordTytherington marked this pull request as ready for review April 4, 2025 15:54
@BenFordTytherington BenFordTytherington force-pushed the add-self-shorthand branch 2 times, most recently from b97d362 to 8d63f02 Compare April 4, 2025 16:55
@BenFordTytherington
Copy link
Collaborator Author

Tried to implement in the qml_features example and there is a cxx error about there being multiple types in the block, even though there is only one qobject in the example, which may be because it adds the QObject import?

@BenFordTytherington BenFordTytherington force-pushed the add-self-shorthand branch 3 times, most recently from 85d8ee3 to edc96d6 Compare May 2, 2025 14:22
@BenFordTytherington BenFordTytherington force-pushed the add-self-shorthand branch 2 times, most recently from f7c81e2 to a654673 Compare May 20, 2025 12:41
Copy link
Collaborator

@LeonMatthesKDAB LeonMatthesKDAB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @BenFordTytherington, I'm very happy to see this work.

There are however some changes I want to see before we merge this. Especially I think it would be better to use an Array of Structures instead of a Structure of Arrays.

Other than that it's just some minor nitpicks left.

…here the type can be inferred

- If exactly one QObject is present in a block with a method, it will infer `Self` to represent that qobject
- Updates one of the examples to test this out
- QObjects, and invokables are now 2D Vecs, kept in their original block
- Adds some helper methods for iterating like they are still flat
- Add function call to cxx-qt-build and cxx-qt-macro
- Inlining now happens after parsing and before structuring
@BenFordTytherington BenFordTytherington force-pushed the add-self-shorthand branch 5 times, most recently from 74b93b5 to 1178075 Compare May 21, 2025 12:19
- Refactor parsing steps to be more readable
- Refactor tests to be better separated
Copy link
Collaborator

@LeonMatthesKDAB LeonMatthesKDAB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful 🔥

@LeonMatthesKDAB LeonMatthesKDAB added this pull request to the merge queue May 21, 2025
Merged via the queue into KDAB:main with commit a87fcb1 May 21, 2025
16 checks passed
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

Successfully merging this pull request may close these issues.

Support for shortand &self in bridge
3 participants