On 01/15/2014 11:29 AM, Nicolas Silva wrote:
I think enums are not a good fit for bitwise operations, it's not really
meant for that.
I came to the same conclusion and came up with a nice macro to automate
that, seen here:
https://github.com/SiegeLord/RustAllegro/blob/master/src/rust_util.rs#L3..L56
and used here
https://github.com/SiegeLord/RustAllegro/blob/master/src/allegro/internal/bitmap_like.rs#L9..L23
.
This enables a nice, C-like API when composing/extracting flags via the
bit-or and bit-and operators.
-SL
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev