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

Bring back auto camel case but explicit this time #1105

Open
ahayzen-kdab opened this issue Oct 18, 2024 · 2 comments
Open

Bring back auto camel case but explicit this time #1105

ahayzen-kdab opened this issue Oct 18, 2024 · 2 comments
Labels
🤔 discussion Feedback welcome 🥳🎉 1.0 This issue is part of stabilization for 1.0 release

Comments

@ahayzen-kdab
Copy link
Collaborator

Instead of implicit auto camel conversion make it explicit and potentially per extern block?

This could look like at a bridge level or extern block level.

#[cxx_qt::bridge(auto_camel_case)]
mod ffi {
  unsafe extern "C++Qt" {
    fn my_function(&self: MyQObject);  // would be myFunction in C++
  }
}

Or

#[cxx_qt::bridge]
mod ffi {
  #[auto_camel_case]
  unsafe extern "C++Qt" {
    fn my_function(&self: MyQObject);  // would be myFunction in C++
  }
}
@ahayzen-kdab ahayzen-kdab added 🤔 discussion Feedback welcome 🥳🎉 1.0 This issue is part of stabilization for 1.0 release labels Oct 18, 2024
@ahayzen-kdab
Copy link
Collaborator Author

The name could also include cxx in it such as cxx_auto_camel, as the way this works is if there is no cxx_name specified it will camel case the effective rust name.

@LeonMatthesKDAB
Copy link
Collaborator

Hm, as we (currently) don't plan to do case conversion on CXX types/blocks, I prefer the per-block style, as it explicitly covers a given scope.

Additionaly, I would call the attribute #[auto_casing], as we are also converting to snake_case, in extern "C++Qt".
(and would leave the door open to specifying your own casing (e.g.: #[auto_casing="PascalCase"] or whatever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤔 discussion Feedback welcome 🥳🎉 1.0 This issue is part of stabilization for 1.0 release
Projects
None yet
Development

No branches or pull requests

2 participants