bitflags/external/
bytemuck.rs

1#[cfg(test)]
2mod tests {
3    use bytemuck::{Pod, Zeroable};
4
5    bitflags! {
6        #[derive(Pod, Zeroable, Clone, Copy)]
7        #[repr(transparent)]
8        struct Color: u32 {
9            const RED = 0x1;
10            const GREEN = 0x2;
11            const BLUE = 0x4;
12        }
13    }
14
15    #[test]
16    fn test_bytemuck() {
17        assert_eq!(0x1, bytemuck::cast::<Color, u32>(Color::RED));
18    }
19}