-
Notifications
You must be signed in to change notification settings - Fork 12
Description
We currently use bindgen to create a considerable number of .rs modules. The idea is to call bindgen many times with a narrow list of whitelisted types. No types are listed multiple times, so each type should appear in one corresponding module and be use'able from there.
This is unfortunately not true because of allowlist transitivity: if a type is in the allowlists and it depends on another type, that type is added to the allowlist. This results in multiple distinct Rust types that correspond to the same C type, with the important example of CassInet: it appears both in cppdriver_inet_types.rs and cppdriver_host_listener_types.rs. Those types are distinct even though identical, and implementation for both must be duplicated.
To solve this, I suggest writing the bindings to a single .rs module. Later, to group things more sensibly instead of having them in one big bag, it's possible to re-export them from different modules as previously.