rust-lang / rust-lang/rust-bindgen
Generate getters/setters to contained anonymous struct/union members
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
We often see code like this:
struct JSJitInfo {
// ...
union {
uint16_t protoID;
js::jit::InlinableNative inlinableNative;
};
// ...
};
which generates members and types like __bindgen_anon_1: JSJitInfo__bindgen_ty_1.
It would be cool if we generated getters/setters on the containing struct for these anonymous structs/unions members, so that using them was easier and more like their usage in C/C++.
Contributor guide
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
Start by locating how bindgen lowers anonymous struct and union members into _bindgen_anon* types. Define the expected getter and setter behavior on the containing struct, using the JSJitInfo example as a reference, then validate the generated bindings against an equivalent C++ declaration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100