pub enum TypeKind {
Show 19 variants
Primitive(PrimitiveKind),
Fixed {
digits: u8,
scale: u8,
},
String {
width: CharWidth,
bound: Bound,
},
Sequence {
element: Ref<TypeNode>,
bound: Bound,
},
Array {
element: Ref<TypeNode>,
dims: Vec<Id<ConstExprNode>>,
},
Map {
key: Ref<TypeNode>,
value: Ref<TypeNode>,
bound: Bound,
},
Structure {
base: Option<Ref<TypeNode>>,
members: Vec<Id<MemberNode>>,
},
Union {
discriminator: Ref<TypeNode>,
cases: Vec<Id<CaseNode>>,
default_case: Option<Id<CaseNode>>,
},
Enumeration {
enumerators: Vec<Id<EnumeratorNode>>,
},
Bitmask {
bits: Vec<Id<BitValueNode>>,
},
Bitset {
base: Option<Ref<TypeNode>>,
fields: Vec<Id<BitfieldNode>>,
},
Alias {
aliased: Ref<TypeNode>,
},
Valuetype {
kind: ValuetypeKind,
bases: Vec<Ref<TypeNode>>,
state: Vec<Id<MemberNode>>,
initializers: Vec<Id<OperationNode>>,
supported: Vec<Ref<InterfaceNode>>,
},
ValueBox {
boxed: Ref<TypeNode>,
},
Native,
ValueBase,
Any,
ObjectRef {
interface: Option<Ref<InterfaceNode>>,
},
AnnotationType {
definition: Id<AnnotationDefNode>,
},
}Expand description
What kind of type this is.
Spec §3.2 — the table there is normative and this enum mirrors it row for row.
Exhaustive on purpose, for the same reason as crate::NodeKind: a
consumer mapping types onto another representation has to account for
each one, and a catch-all would let a new kind pass as nothing.
Variants§
Primitive(PrimitiveKind)
Built-in scalar.
Fixed
fixed<digits, scale>.
String
string or wstring.
Sequence
sequence<T> or sequence<T, N>.
Array
T name[d1][d2].
Fields
dims: Vec<Id<ConstExprNode>>Dimensions, outermost first.
Map
map<K, V> or map<K, V, N>.
Structure
struct.
Fields
members: Vec<Id<MemberNode>>Members in declaration order.
Union
union.
Fields
Enumeration
enum.
Fields
enumerators: Vec<Id<EnumeratorNode>>Enumerators in declaration order.
Bitmask
bitmask.
Fields
bits: Vec<Id<BitValueNode>>Bit values in declaration order.
Bitset
bitset.
Fields
fields: Vec<Id<BitfieldNode>>Bitfields in declaration order.
Alias
typedef.
Valuetype
valuetype.
Fields
kind: ValuetypeKindModifier.
state: Vec<Id<MemberNode>>State members in declaration order.
initializers: Vec<Id<OperationNode>>Initialisers.
supported: Vec<Ref<InterfaceNode>>Supported interfaces.
ValueBox
Boxed value.
Native
native — opaque, name only.
ValueBase
ValueBase. OMG IDL 4.2 §7.4.7, rules (131) and (132).
The abstract base every valuetype has, written as a type: a value
of any valuetype, whichever one arrives. It carries no reference
for the same reason Object carries none — rule (131) is
<value_base_type> ::= "ValueBase" and names nothing — and no
state, because the base declares none.
CORBA CDR encodes one as a chunked value with its repository id ahead of it. DDS-XTypes has neither valuetypes nor this, so the layout planner refuses it by name.
Any
any. OMG IDL 4.2 §7.4.2, rules (69) and (70).
A value of any type, carrying its own type description. Building
Block Any is one of the fifteen and this project takes all
fifteen, so it is in the model — but it has no wire form under
DDS-XTypes, which has no any at all. CORBA CDR writes a
TypeCode and then the value; that is the only encoding in which
it means anything, and the layout planner refuses it by name for
every other one.
It carries no reference: what an any holds is decided at run
time and is not part of the declaration.
ObjectRef
An object reference.
Either the generic one — Object, OMG IDL 4.2 §7.4.6 rules (117)
and (118) — or an interface used as a data type.
Fields
interface: Option<Ref<InterfaceNode>>The referenced interface, absent for the generic Object.
Rule (117) is <object_type> ::= "Object" and names no
interface at all, so there is nothing to point at. None
says that, where a reference to an invented CORBA::Object
declaration would say the file had one.
AnnotationType
A type introduced by an @annotation declaration.
Fields
definition: Id<AnnotationDefNode>The declaration.
Implementations§
Source§impl TypeKind
impl TypeKind
Sourcepub const fn is_member_aggregate(&self) -> bool
pub const fn is_member_aggregate(&self) -> bool
Whether this kind aggregates members that carry member ids — struct and valuetype state. Union cases carry ids through their member, which is why unions are not listed here.
Sourcepub fn members(&self) -> &[Id<MemberNode>]
pub fn members(&self) -> &[Id<MemberNode>]
The members of an aggregate, empty for every other kind.
Sourcepub fn type_refs(&self) -> Vec<&Ref<TypeNode>>
pub fn type_refs(&self) -> Vec<&Ref<TypeNode>>
Every type this kind references directly, resolved or not.
Drives cycle-safe traversal and layout dependency collection.
Sourcepub fn type_refs_mut(&mut self) -> Vec<&mut Ref<TypeNode>>
pub fn type_refs_mut(&mut self) -> Vec<&mut Ref<TypeNode>>
The same references, mutably and in the same order.
The order is the slot numbering the undo log uses to name one reference of a kind that holds several, so the two functions have to stay in step; both are written as one match over every kind.