scylladb / scylladb/cpp-rs-driver
Deduplicate bindgen-generated entities
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 26
- Forks
- 19
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 7
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect the bindgen generation setup and the generated modules, especially cppdriver_inet_types.rs and cppdriver_host_listener_types.rs, where CassInet is duplicated. Confirm how allowlist transitivity creates repeated Rust types, then make the generated bindings use one shared module while preserving access to the entities from their intended modules.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, tooling
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100