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

Explore using Fn/FnOnce trampolines for queuing onto CxxQtThread and for signal connections #595

Closed
LeonMatthesKDAB opened this issue Jun 26, 2023 · 1 comment
Assignees
Labels
⬆️ feature New feature or request 👷 refactor Something needs to change 🥳🎉 1.0 This issue is part of stabilization for 1.0 release

Comments

@LeonMatthesKDAB
Copy link
Collaborator

See: dtolnay/cxx#668

In the above discussion this approach is linked: https://adventures.michaelfbryan.com/posts/rust-closures-in-ffi/
It may save us from having to do so much heap-allocation and wrapping for executing closures in the cxx-qt-thread.
So explore if this is feasible and which (dis-)advantages it brings.

Ideally we could also use this approach to allow closures when connecting to signals.

@LeonMatthesKDAB LeonMatthesKDAB added ⬆️ feature New feature or request 👷 refactor Something needs to change labels Jun 26, 2023
@ahayzen-kdab ahayzen-kdab added the 🥳🎉 1.0 This issue is part of stabilization for 1.0 release label Aug 18, 2023
@ahayzen-kdab ahayzen-kdab changed the title Explore using Fn/FnOnce trampolines for queuing onto CxxQtThread Explore using Fn/FnOnce trampolines for queuing onto CxxQtThread and for signal connections Aug 18, 2023
@ahayzen-kdab
Copy link
Collaborator

We also need to allow for closures (FnMut) in signal connections. Otherwise you cannot move a binding into the closure to use in the connection. Eg the following doesn't work.

let qt_thread = self.qt_thread();
anotherObject.on_signal(|ctx| {
  // cannot move the qt_thread here
  // as the on_signal is just a function ptr ( fn )
  // instead of a closure ( FnMut )
  qt_thread.queue(|ctx| { ... });
});

ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Aug 25, 2023
This allows us to add includes later to the struct.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Aug 25, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Sep 20, 2023
This allows us to add includes later to the struct.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Sep 20, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Sep 21, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Sep 21, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Oct 3, 2023
This allows us to add includes later to the struct.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Oct 3, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Oct 3, 2023
This allows for FnMut to be used for signals later.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Oct 20, 2023
This allows us to add includes later to the struct.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Oct 20, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Oct 20, 2023
This allows for FnMut to be used for signals later.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Oct 31, 2023
This allows us to add includes later to the struct.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Oct 31, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Oct 31, 2023
This allows for FnMut to be used for signals later.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 1, 2023
This allows us to add includes later to the struct.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 1, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 1, 2023
This allows for FnMut to be used for signals later.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 1, 2023
Also reuse same code path for RustQt and C++Qt signals.

Closes KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 1, 2023
Also reuse same code path for RustQt and C++Qt signals.

Closes KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 8, 2023
This allows us to add includes later to the struct.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 8, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 8, 2023
This allows for FnMut to be used for signals later.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 15, 2023
This allows us to add includes later to the struct.

Related to KDAB#595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 15, 2023
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 15, 2023
This allows for FnMut to be used for signals later.

Related to KDAB#595
ahayzen-kdab added a commit that referenced this issue Nov 15, 2023
This allows us to add includes later to the struct.

Related to #595
ahayzen-kdab added a commit that referenced this issue Nov 15, 2023
This allows for FnMut to be used for signals later.

Related to #595
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Nov 15, 2023
Also reuse same code path for RustQt and C++Qt signals.

Closes KDAB#595
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⬆️ feature New feature or request 👷 refactor Something needs to change 🥳🎉 1.0 This issue is part of stabilization for 1.0 release
Projects
None yet
Development

No branches or pull requests

2 participants