-
Notifications
You must be signed in to change notification settings - Fork 82
WIP add book entry for instantiating in Rust #1229
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
base: main
Are you sure you want to change the base?
WIP add book entry for instantiating in Rust #1229
Conversation
8323dcd
to
701404f
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1229 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 73 73
Lines 12612 12612
=========================================
Hits 12612 12612 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
064933a
to
b81db2f
Compare
@BenFordTytherington Please also document that you can add constructor arguments if required :) |
I wasn't aware that was an option with these templates, what would that syntax look like? |
b81db2f
to
16ec690
Compare
@BenFordTytherington , it follows the same pattern as our
You just declare the appropriate parameters and if the declared parameters match an existing constructor it will just work :) Most QObjects for example can be created with an optional #[namespace = "rust::cxxqtlib1"]
unsafe extern "C++" {
include!("cxx-qt-lib/common.h");
#[rust_name = "my_object_new"]
fn make_unique() -> UniquePtr<MyObject>;
#[rust_name = "my_object_new_with_parent"]
fn make_unique(parent: *mut QObject) -> UniquePtr<MyObject>;
} I think the docs should also mention that these functions are provided by CXX-Qt-lib as helper functions (which explains why they are in the rust::cxxqtlib1 namespace. |
c7ad9d6
to
e39c5b1
Compare
e39c5b1
to
e4ab2f6
Compare
No description provided.