How can I only generate #[derive(Clone)] by bindgen?

262 Views Asked by At

I am using bindgen to generate code with the following config.

let mut builder = bindgen::Builder::default()
    .clang_arg("-std=c++11")
    .clang_arg("-x")
    .clang_arg("c++")
    .clang_arg("-Wno-pragma-once-outside-header")
    .layout_tests(false)
    .derive_copy(true)
    .enable_cxx_namespaces()
    .default_enum_style(EnumVariation::Rust {
        non_exhaustive: false,
    });

However I find that the generated code like

#[derive(Debug, Copy, Clone)]
pub struct RawCppPtr {
    pub ptr: root::DB::RawVoidPtr,
    pub type_: root::DB::RawCppPtrType,
}

I wonder if there are any ways that I can only generate #[derive(Clone)] without generating [derive(Copy)]?

0

There are 0 best solutions below