Attributes
namespace
The C++ namespace which to emit extern "RustQt"
items and the namespace to find extern "C++Qt"
items.
An item will inherit the namespace specified on it's surrounding extern
block if any,
otherwise the namespace specified with the top level cxx_qt::bridge
attribute, if any, will be used.
#[cxx_qt::bridge(cxx_file_stem = "threading_website", namespace = "cxx_qt::website")]
pub mod qobject {
Note that
#[namespace = "..."]
may not work on all items, we hope to improve this in future this support in the future.
cxx_name and rust_name
The #[cxx_name = "..."]
attribute replaces the name that C++ should use for this item.
The #[rust_name = "..."]
attribute replaces the name that Rust should use for this item.
Note that
#[cxx_name = "..."]
and#[rust_name = "..."]
may not work on all items, we hope to improve this in future this support in the future.
If no #[cxx_name = "..."]
or #[rust_name = "..."]
is specified, CXX-Qt will perform an automatic conversion to function names as specified in the table below.
Rust | C++ | |
---|---|---|
extern "C++Qt" | - | camelCase |
extern "RustQt" | - | camelCase |
Note that in some cases
snake_case
conversions may occur for generated functions in Rust (egon_<signal>
).
Note that this table may change to the following conversions in the future.
Rust C++ extern "C++Qt"
snake_case - extern "RustQt"
- camelCase