pub struct Qualifiers(/* private fields */);Expand description
The qualifiers a type can carry.
A bitmask in the interning key rather than a chain of wrapper nodes, so const int is one
entry in the table beside int rather than a node pointing at it. That makes stripping
qualifiers a field read instead of a walk, which matters because almost every semantic rule
in C is stated on the unqualified type.
_Atomic is deliberately not here. C lets it be written in the same position as a
qualifier, but _Atomic(T) is a different type from T with its own size and alignment,
so it is a type constructor, TypeKind::Atomic, and the parser is what maps the
qualifier spelling onto it.
Implementations§
Source§impl Qualifiers
impl Qualifiers
Sourcepub const NONE: Qualifiers
pub const NONE: Qualifiers
No qualifiers.
Sourcepub const CONST: Qualifiers
pub const CONST: Qualifiers
const.
Sourcepub const VOLATILE: Qualifiers
pub const VOLATILE: Qualifiers
volatile.
Sourcepub const RESTRICT: Qualifiers
pub const RESTRICT: Qualifiers
restrict.
Sourcepub const SEG_FS: Qualifiers
pub const SEG_FS: Qualifiers
__seg_fs, the x86 named address space counted from the %fs segment base.
A named address space is a qualifier in the C extension that defines them (ISO/IEC TR
18037) and in gcc, so it lives here with the other three. Two pointers to the same type in
different address spaces are different types, which the table gets for free by keeping
the qualifier on the pointee, and lvalue conversion drops it the way it drops const.
Sourcepub const SEG_GS: Qualifiers
pub const SEG_GS: Qualifiers
__seg_gs, the same for the %gs segment base, which is what the Linux percpu
accessors on x86 use from 6.9.
Sourcepub const SPACES: Qualifiers
pub const SPACES: Qualifiers
Both address space qualifiers, for asking which one a type is in.
Sourcepub const fn has(self, other: Qualifiers) -> bool
pub const fn has(self, other: Qualifiers) -> bool
Whether every qualifier in other is present here.
Sourcepub const fn with(self, other: Qualifiers) -> Qualifiers
pub const fn with(self, other: Qualifiers) -> Qualifiers
This set with other added.
Sourcepub const fn without(self, other: Qualifiers) -> Qualifiers
pub const fn without(self, other: Qualifiers) -> Qualifiers
This set with other removed.
Sourcepub const fn space(self) -> Qualifiers
pub const fn space(self) -> Qualifiers
The address space qualifier on this set, which is Qualifiers::NONE for the generic
one.