#[repr(C)]pub struct TypeClass { /* private fields */ }
Implementations
sourceimpl TypeClass
impl TypeClass
pub const INVALID: TypeClass = Self{ bits: 0,}
pub const ARRAY: TypeClass = Self{ bits: 1,}
pub const BLOCKPOINTER: TypeClass = Self{ bits: 2,}
pub const BUILTIN: TypeClass = Self{ bits: 4,}
pub const CLASS: TypeClass = Self{ bits: 8,}
pub const COMPLEX_FLOAT: TypeClass = Self{ bits: 16,}
pub const COMPLEX_INTEGER: TypeClass = Self{ bits: 32,}
pub const ENUMERATION: TypeClass = Self{ bits: 64,}
pub const FUNCTION: TypeClass = Self{ bits: 128,}
pub const MEMBER_POINTER: TypeClass = Self{ bits: 256,}
pub const OBJC_OBJECT: TypeClass = Self{ bits: 512,}
pub const OBJC_INTERFACE: TypeClass = Self{ bits: 1024,}
pub const OBJC_OBJECT_POINTER: TypeClass = Self{ bits: 2048,}
pub const POINTER: TypeClass = Self{ bits: 4096,}
pub const REFERENCE: TypeClass = Self{ bits: 8192,}
pub const STRUCT: TypeClass = Self{ bits: 16384,}
pub const TYPEDEF: TypeClass = Self{ bits: 32768,}
pub const UNION: TypeClass = Self{ bits: 65536,}
pub const VECTOR: TypeClass = Self{ bits: 131072,}
pub const OTHER: TypeClass = Self{ bits: 2147483648,}
pub const ANY: TypeClass = Self{ bits: 4294967295,}
sourcepub const fn from_bits(bits: u32) -> Option<TypeClass>
pub const fn from_bits(bits: u32) -> Option<TypeClass>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
sourcepub const fn from_bits_truncate(bits: u32) -> TypeClass
pub const fn from_bits_truncate(bits: u32) -> TypeClass
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
sourcepub const unsafe fn from_bits_unchecked(bits: u32) -> TypeClass
pub const unsafe fn from_bits_unchecked(bits: u32) -> TypeClass
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Safety
The caller of the bitflags!
macro can chose to allow or
disallow extra bits for their bitflags type.
The caller of from_bits_unchecked()
has to ensure that
all bits correspond to a defined flag or that extra bits
are valid for this bitflags type.
sourcepub const fn intersects(&self, other: TypeClass) -> bool
pub const fn intersects(&self, other: TypeClass) -> bool
Returns true
if there are flags common to both self
and other
.
sourcepub const fn contains(&self, other: TypeClass) -> bool
pub const fn contains(&self, other: TypeClass) -> bool
Returns true
if all of the flags in other
are contained within self
.
sourcepub fn set(&mut self, other: TypeClass, value: bool)
pub fn set(&mut self, other: TypeClass, value: bool)
Inserts or removes the specified flags depending on the passed value.
sourcepub const fn intersection(self, other: TypeClass) -> TypeClass
pub const fn intersection(self, other: TypeClass) -> TypeClass
Returns the intersection between the flags in self
and
other
.
Specifically, the returned set contains only the flags which are
present in both self
and other
.
This is equivalent to using the &
operator (e.g.
ops::BitAnd
), as in flags & other
.
sourcepub const fn union(self, other: TypeClass) -> TypeClass
pub const fn union(self, other: TypeClass) -> TypeClass
Returns the union of between the flags in self
and other
.
Specifically, the returned set contains all flags which are
present in either self
or other
, including any which are
present in both (see Self::symmetric_difference
if that
is undesirable).
This is equivalent to using the |
operator (e.g.
ops::BitOr
), as in flags | other
.
sourcepub const fn difference(self, other: TypeClass) -> TypeClass
pub const fn difference(self, other: TypeClass) -> TypeClass
Returns the difference between the flags in self
and other
.
Specifically, the returned set contains all flags present in
self
, except for the ones present in other
.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other
(and this syntax is also supported).
This is equivalent to using the -
operator (e.g.
ops::Sub
), as in flags - other
.
sourcepub const fn symmetric_difference(self, other: TypeClass) -> TypeClass
pub const fn symmetric_difference(self, other: TypeClass) -> TypeClass
Returns the symmetric difference between the flags
in self
and other
.
Specifically, the returned set contains the flags present which
are present in self
or other
, but that are not present in
both. Equivalently, it contains the flags present in exactly
one of the sets self
and other
.
This is equivalent to using the ^
operator (e.g.
ops::BitXor
), as in flags ^ other
.
sourcepub const fn complement(self) -> TypeClass
pub const fn complement(self) -> TypeClass
Returns the complement of this set of flags.
Specifically, the returned set contains all the flags which are
not set in self
, but which are allowed for this type.
Alternatively, it can be thought of as the set difference
between Self::all()
and self
(e.g. Self::all() - self
)
This is equivalent to using the !
operator (e.g.
ops::Not
), as in !flags
.
Trait Implementations
sourceimpl BitAndAssign<TypeClass> for TypeClass
impl BitAndAssign<TypeClass> for TypeClass
sourcefn bitand_assign(&mut self, other: TypeClass)
fn bitand_assign(&mut self, other: TypeClass)
Disables all flags disabled in the set.
sourceimpl BitOrAssign<TypeClass> for TypeClass
impl BitOrAssign<TypeClass> for TypeClass
sourcefn bitor_assign(&mut self, other: TypeClass)
fn bitor_assign(&mut self, other: TypeClass)
Adds the set of flags.
sourceimpl BitXorAssign<TypeClass> for TypeClass
impl BitXorAssign<TypeClass> for TypeClass
sourcefn bitxor_assign(&mut self, other: TypeClass)
fn bitxor_assign(&mut self, other: TypeClass)
Toggles the set of flags.
sourceimpl Extend<TypeClass> for TypeClass
impl Extend<TypeClass> for TypeClass
sourcefn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = TypeClass>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = TypeClass>,
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)sourceimpl FromIterator<TypeClass> for TypeClass
impl FromIterator<TypeClass> for TypeClass
sourceimpl Ord for TypeClass
impl Ord for TypeClass
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
sourceimpl PartialOrd<TypeClass> for TypeClass
impl PartialOrd<TypeClass> for TypeClass
sourcefn partial_cmp(&self, other: &TypeClass) -> Option<Ordering>
fn partial_cmp(&self, other: &TypeClass) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresourceimpl SubAssign<TypeClass> for TypeClass
impl SubAssign<TypeClass> for TypeClass
sourcefn sub_assign(&mut self, other: TypeClass)
fn sub_assign(&mut self, other: TypeClass)
Disables all flags enabled in the set.