I have run into an issue with rust-bindgen where the bitfield objects made do not actually map correctly onto the underlying C structure.
Here is a small, self contained sample where you can observe the issue: https://github.com/avahahn/bindgen-issue-repro
Here, I have a struct with a number of fields, including these two specifically:
(lib.h)
typedef struct {
(... omitted ...)
unsigned request_body_file_log_level : 3;
unsigned request_body_no_buffering : 1;
} fields;
When working with this struct definition in rust you might expect that calling the following code will result in setting request_body_no_buffering to 1:
global_fields.set_request_body_no_buffering(1);
However, it does not. Instead it sets request_body_file_log_level to 2. This reproduces on my x86_64 box as well as my arm64 box.
I have run into an issue with rust-bindgen where the bitfield objects made do not actually map correctly onto the underlying C structure.
Here is a small, self contained sample where you can observe the issue: https://github.com/avahahn/bindgen-issue-repro
Here, I have a struct with a number of fields, including these two specifically:
(lib.h)
When working with this struct definition in rust you might expect that calling the following code will result in setting
request_body_no_bufferingto1:However, it does not. Instead it sets
request_body_file_log_levelto2. This reproduces on my x86_64 box as well as my arm64 box.