Translating c++'s union struct bitfield to rust

Viewed 28

In C++ one can represent a 8 bit value like this

union
{
    struct
    {
        uint8_t bit01234 : 5;
        uint8_t bit5 : 1;
        uint8_t bit6 : 1;
        uint8_t bit7 : 1;
    };

    uint8_t value;
} mask;

How to translate this data structure into rust?

0 Answers
Related