cxx-qt icon indicating copy to clipboard operation
cxx-qt copied to clipboard

Bring back auto camel case but explicit this time

Open ahayzen-kdab opened this issue 1 year ago • 2 comments

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 avatar Oct 18 '24 15:10 ahayzen-kdab

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.

ahayzen-kdab avatar Oct 21 '24 08:10 ahayzen-kdab

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.

LeonMatthesKDAB avatar Oct 21 '24 08:10 LeonMatthesKDAB

Implemented and merged in #1108

BenFordTytherington avatar Oct 28 '24 16:10 BenFordTytherington