Blanket impl `ProjectField` for struct and union types
- Dominant language
- Rust
- Stars
- 2.6k
- Forks
- 179
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 29
Description
...using `STRUCT_VARIANT_ID` and `UNION_VARIANT_ID`.
This applies once https://github.com/google/zerocopy/pull/2886 lands, which introduces that machinery. That PR provides a default impl of `ProjectField:: is_projectable`, and uses a PME to ensure that it's overridden for enum impls. It also implements `ProjectField` for all struct and union types manually in their respective derives.
We can instead provide a two blanket impls – one for structs and one for unions – and thus remove both the default impl of `is_projectable` and the impls emitted by derive code.
We'll want to look at the rustdoc output to see how this change affects it. In particular, we want it to be the case that, for a user-defined type, the rustdoc page for that type shows `ProjectField` impls for that type.
Contributor guide
Assessment
This issue has not been assessed yet.