rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

Add additional helpers to bitmask data structure

Open jbaublitz opened this issue 1 year ago • 4 comments

Closes #2674

jbaublitz avatar Jul 30 '24 20:07 jbaublitz

@y86-dev Can you confirm that this resolves your issue? Now that it's passing CI, I think it's ready for review.

@ojeda @emilio Also feel free to let me know if you have any feedback.

jbaublitz avatar Aug 01 '24 14:08 jbaublitz

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.
  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.

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.

BennoLossin avatar Aug 01 '24 17:08 BennoLossin

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.

jbaublitz avatar Aug 01 '24 18:08 jbaublitz

I tested it again and it LGTM, thanks!

BennoLossin avatar Aug 02 '24 18:08 BennoLossin

@pvdrz Hi! This PR is ready I think assuming @ojeda is okay with it.

jbaublitz avatar Sep 17 '24 14:09 jbaublitz