Skip to main content

Module collection

Module collection 

Source
Expand description

Collection (sequence/array) DynamicTypes that retain a fully resolved element DynamicType.

The public TypeDescriptor keeps only a shallow element descriptor (element_type: Box<TypeDescriptor>) — enough for scalar elements, but it drops the members of a composite element (sequence<Struct> etc.), which the reflective codec needs to recurse. Rather than widen the core type model (and the TypeObject bridge that builds on it), this module constructs the collection DynamicType with the resolved element kept as its single synthetic member (index 0). resolved_element reads it back; the codec prefers it and falls back to rebuilding a scalar element from the descriptor when absent (so collections built the plain way still decode).

Functions§

array_of
Build an Element[dims...] array type that retains the fully-resolved element type.
resolved_element
The resolved element DynamicType of a collection, if one was attached via sequence_of / array_of. Returns None for collections that carry only a shallow scalar element descriptor (the codec rebuilds those itself).
sequence_of
Build a sequence<Element> type (bound 0 = unbounded) that retains the fully-resolved element type for the reflective codec.