Skip to main content

bitflags_array

Macro bitflags_array 

Source
macro_rules! bitflags_array {
    (
            $(#[$outer:meta])*
            pub struct ($name:ident, $name_bits:ident): [$T:ty; $Len:expr];

            $(
                $(#[$bit_outer:meta])*
                $vis:vis struct $inner_name:ident $lower_inner_name:ident {
                    $(
                        $(#[doc $($args:tt)*])*
                        #[name($str_name:literal $(, $alias:literal)*)]
                        const $Flag:tt = $value:expr;
                    )*
                }
            )*
        ) => { ... };
    (
            $(#[$outer:meta])*
            pub struct ($name:ident, $name_bits:ident): [$T:ty; $Len:expr];

            $(
                $(#[$bit_outer:meta])*
                $vis:vis struct $inner_name:ident $lower_inner_name:ident {
                    $(
                        $(#[doc $($args:tt)*])*
                        const $Flag:tt = $value:expr;
                    )*
                }
            )*
        ) => { ... };
}
Expand description

Macro for creating sets of bitflags, we need this because there are almost more flags than bits in a u64, we can’t use a u128 because of FFI, and the number of flags is increasing.

Alternatively we also want to separate WebGPU features from native WGPU features.