Lines Matching refs:BitFlags
336 pub struct $BitFlags:ident: $T:ty {
345 (pub) $BitFlags: $T {
355 struct $BitFlags:ident: $T:ty {
364 () $BitFlags: $T {
374 pub ($($vis:tt)+) struct $BitFlags:ident: $T:ty {
383 (pub ($($vis)+)) $BitFlags: $T {
398 ($($vis:tt)*) $BitFlags:ident: $T:ty {
407 $($vis)* struct $BitFlags {
412 $BitFlags: $T {
480 $BitFlags:ident: $T:ty {
487 impl $crate::_core::fmt::Debug for $BitFlags {
507 impl __BitFlags for $BitFlags {
526 if <$BitFlags as __BitFlags>::$Flag(self) {
534 let extra_bits = self.bits & !$BitFlags::all().bits();
549 impl $crate::_core::fmt::Binary for $BitFlags {
554 impl $crate::_core::fmt::Octal for $BitFlags {
559 impl $crate::_core::fmt::LowerHex for $BitFlags {
564 impl $crate::_core::fmt::UpperHex for $BitFlags {
571 impl $BitFlags {
574 pub const $Flag: $BitFlags = $BitFlags { bits: $value };
580 pub const fn empty() -> $BitFlags {
581 $BitFlags { bits: 0 }
588 pub const fn all() -> $BitFlags {
596 impl __BitFlags for $BitFlags {
605 $BitFlags { bits: $(<$BitFlags as __BitFlags>::$Flag)|+ }
620 pub fn from_bits(bits: $T) -> $crate::_core::option::Option<$BitFlags> {
621 if (bits & !$BitFlags::all().bits()) == 0 {
622 $crate::_core::option::Option::Some($BitFlags { bits })
632 pub const fn from_bits_truncate(bits: $T) -> $BitFlags {
633 $BitFlags { bits: bits & $BitFlags::all().bits }
641 pub const unsafe fn from_bits_unchecked(bits: $T) -> $BitFlags {
642 $BitFlags { bits }
650 self.bits() == $BitFlags::empty().bits()
658 self.bits == $BitFlags::all().bits
665 pub const fn intersects(&self, other: $BitFlags) -> bool {
666 !$BitFlags{ bits: self.bits & other.bits}.is_empty()
673 pub const fn contains(&self, other: $BitFlags) -> bool {
680 pub fn insert(&mut self, other: $BitFlags) {
686 pub fn remove(&mut self, other: $BitFlags) {
692 pub fn toggle(&mut self, other: $BitFlags) {
698 pub fn set(&mut self, other: $BitFlags, value: bool) {
707 impl $crate::_core::ops::BitOr for $BitFlags {
708 type Output = $BitFlags;
712 fn bitor(self, other: $BitFlags) -> $BitFlags {
713 $BitFlags { bits: self.bits | other.bits }
717 impl $crate::_core::ops::BitOrAssign for $BitFlags {
721 fn bitor_assign(&mut self, other: $BitFlags) {
726 impl $crate::_core::ops::BitXor for $BitFlags {
727 type Output = $BitFlags;
731 fn bitxor(self, other: $BitFlags) -> $BitFlags {
732 $BitFlags { bits: self.bits ^ other.bits }
736 impl $crate::_core::ops::BitXorAssign for $BitFlags {
740 fn bitxor_assign(&mut self, other: $BitFlags) {
745 impl $crate::_core::ops::BitAnd for $BitFlags {
746 type Output = $BitFlags;
750 fn bitand(self, other: $BitFlags) -> $BitFlags {
751 $BitFlags { bits: self.bits & other.bits }
755 impl $crate::_core::ops::BitAndAssign for $BitFlags {
759 fn bitand_assign(&mut self, other: $BitFlags) {
764 impl $crate::_core::ops::Sub for $BitFlags {
765 type Output = $BitFlags;
769 fn sub(self, other: $BitFlags) -> $BitFlags {
770 $BitFlags { bits: self.bits & !other.bits }
774 impl $crate::_core::ops::SubAssign for $BitFlags {
778 fn sub_assign(&mut self, other: $BitFlags) {
783 impl $crate::_core::ops::Not for $BitFlags {
784 type Output = $BitFlags;
788 fn not(self) -> $BitFlags {
789 $BitFlags { bits: !self.bits } & $BitFlags::all()
793 impl $crate::_core::iter::Extend<$BitFlags> for $BitFlags {
794 … fn extend<T: $crate::_core::iter::IntoIterator<Item=$BitFlags>>(&mut self, iterator: T) {
801 impl $crate::_core::iter::FromIterator<$BitFlags> for $BitFlags {
802 … fn from_iter<T: $crate::_core::iter::IntoIterator<Item=$BitFlags>>(iterator: T) -> $BitFlags {