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

Support all types that CXX supports for C++ generation side #328

Closed
9 tasks done
ahayzen-kdab opened this issue Oct 19, 2022 · 6 comments
Closed
9 tasks done

Support all types that CXX supports for C++ generation side #328

ahayzen-kdab opened this issue Oct 19, 2022 · 6 comments
Assignees
Labels
🪲 bug Something isn't working
Milestone

Comments

@ahayzen-kdab
Copy link
Collaborator

ahayzen-kdab commented Oct 19, 2022

In the C++ generation we have to map Rust types to C++ types, here not all types have been mapped.

Some of the missing types

https://github.com/KDAB/cxx-qt/blob/main/crates/cxx-qt-gen/src/generator/cpp/types.rs

@ahayzen-kdab ahayzen-kdab added the 🪲 bug Something isn't working label Oct 19, 2022
@ahayzen-kdab ahayzen-kdab added this to the 0.5 milestone Oct 19, 2022
@LeonMatthesKDAB
Copy link
Collaborator

Could we get this exposed by upstream?
E.g. could CXX somehow tell us how to transform this stuff...

@ahayzen-kdab
Copy link
Collaborator Author

Maybe, but they have already parsed the types into their own enum via syn. We would have to expose some API to get from our syn types to the theirs etc.

@ahayzen-kdab
Copy link
Collaborator Author

Could be worth a discussion upstream though if something like the cxx-gen crate could expose something like this. It would need to be able to go from a Rust syn::Type to a C++ String. We would also need to know if the type means that we need to mark the CXX bridge method as unsafe (eg fn is_unsafe(ty: &syn::Type) -> bool).

@ahayzen-kdab
Copy link
Collaborator Author

Note that CXX has it's own Type can calls syn's Type as RustType https://github.com/dtolnay/cxx/blob/a6e1cd1e8d9d6df20e88e7443963dc4c5c8c4875/syntax/mod.rs#L226

Effectively we need fn parse_type(ty: &RustType) -> Result<Type> to be public or part of a public API to then generate the C++ string https://github.com/dtolnay/cxx/blob/a6e1cd1e8d9d6df20e88e7443963dc4c5c8c4875/syntax/parse.rs#L1134

@ahayzen-kdab
Copy link
Collaborator Author

autocxx also has similar things in their code

@ahayzen-kdab ahayzen-kdab self-assigned this Dec 14, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 14, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 14, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 15, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 15, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 15, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 16, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 16, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 16, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 16, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
ahayzen-kdab added a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
Be-ing pushed a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
Be-ing pushed a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
Be-ing pushed a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
Be-ing pushed a commit to ahayzen-kdab/cxx-qt that referenced this issue Dec 19, 2022
Be-ing pushed a commit that referenced this issue Dec 19, 2022
Be-ing pushed a commit that referenced this issue Dec 19, 2022
Be-ing pushed a commit that referenced this issue Dec 19, 2022
Be-ing pushed a commit that referenced this issue Dec 19, 2022
@ahayzen-kdab
Copy link
Collaborator Author

Split out Result as that is more complicated #404 .

przempore pushed a commit to przempore/cxx-qt that referenced this issue Mar 15, 2023
przempore pushed a commit to przempore/cxx-qt that referenced this issue Mar 15, 2023
przempore pushed a commit to przempore/cxx-qt that referenced this issue Mar 15, 2023
przempore pushed a commit to przempore/cxx-qt that referenced this issue Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪲 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants