Allow shared types as inner Rust types #1107
Unanswered
LeonMatthesKDAB
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Random idea that occured to me today:
We can get rid of the
Box<MyObjectRust>in the C++ QObject, if ourMyObjectRustis a shared CXX type.Our syntax of
type MyObject = super::MyObjectRustis already meant to accept other types in the future instead of justsuper::....The easiest thing to support is just:
type MyObject = MyObjectRust, whereMyObjectRustcan be any type that is declared in the bridge.Now if
MyObjectRustisn't anexterntype, but a shared type, we could actually omit theBox<>on the C++ side, and have the MyObjectRust inline, which would avoid the overhead of dereferencing.I know of two challenges with this idea:
newfunction currently returns aBox<CxxQtType::Rust>. Unless we want to break API, we still need to create a box during Construction and then move out of it after. That's not a big deal, but is suboptimal.Beta Was this translation helpful? Give feedback.
All reactions