Bindgen nicely replaces occurrences of native C types with Rust types. For example:
#include <stdint.h>
typedef struct
{
const uint8_t b[16];
} MunGuid;
results in:
#[repr(C)]
#[derive(Clone, Copy)]
pub struct Guid {
pub b: [u8; 16usize],
}
It works. Lovely! One problem, once we run CI, it turns out that Ubuntu also generates this additional line
pub type __uint8_t = ::std::os::raw::c_uchar;
Even though bindgen is able to deduce that uint8_t is supposed to be u8, it still adds the __uint8_t type to the generated bindings.
One possible solution that I came up with to resolved this is to blacklist the __uint8_t type, but then bindgen stops automatically generating the #[derive(Clone, Copy)] attributes.
Is there a way to prevent the generation of "replaced" types?
Bindgen nicely replaces occurrences of native C types with Rust types. For example:
results in:
It works. Lovely! One problem, once we run CI, it turns out that Ubuntu also generates this additional line
Even though bindgen is able to deduce that
uint8_tis supposed to beu8, it still adds the__uint8_ttype to the generated bindings.One possible solution that I came up with to resolved this is to blacklist the
__uint8_ttype, but then bindgen stops automatically generating the#[derive(Clone, Copy)]attributes.Is there a way to prevent the generation of "replaced" types?