1 macro_rules! define_mask {
2 { $(#[$attr:meta])* struct $name:ident($type:ty); } => {
4 #[allow(non_camel_case_types)]
5 #[derive(Copy, Clone, Default, PartialEq, PartialOrd, Eq, Ord, Hash)]
7 pub struct $name(pub(crate) $type);
10 /// Construct a mask from the given value.
11 pub const fn new(value: bool) -> Self {
19 /// Test if the mask is set.
20 pub const fn test(&self) -> bool {
25 impl core::convert::From<bool> for $name {
26 fn from(value: bool) -> Self {
31 impl core::convert::From<$name> for bool {
32 fn from(mask: $name) -> Self {
37 impl core::fmt::Debug for $name {
38 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
51 #[doc = "16-bit mask"]
56 #[doc = "32-bit mask"]
61 #[doc = "64-bit mask"]
66 #[doc = "128-bit mask"]
71 #[doc = "`isize`-wide mask"]
72 struct masksize(isize);