Add additional helpers to bitfield data structure by jbaublitz · Pull Request #2876 · rust-lang/rust-bindgen (original) (raw)

Hi, thanks for working on this! I tried your branch with the kernel repo and the code seems to look like what we would want, but I have a couple notes:

1. in the kernel, we don't have `std` (and I would imagine that many users of `bindgen` would not want to rely on having it, do you test for this in your CI?) and thus the generated code doesn't compile. The fix is probably to just replace `std` with `core`.

Whoops, I saw that bindgen used std in generated code, but it must be feature flagged. Regardless, I can see how that would be undesirable. I'll fix that up.

2. I am not so sure if my initial naming suggestion was the best, at the moment I like `field_raw` better than `raw_field` for the raw getter, the setter name seems fine to me, but if you think making it `set_field_raw`, then that also seems good to me.

Okay I'll change it!

Otherwise the code looks good to me, maybe Miguel finds something else. Also cc @nbdd0121, it might be a good idea to let him also take a look.