Generics, Generated Types, and Erasure
Generated archetypes such as Points3D give callers concrete constructors,
builders, descriptors, and documentation. Components implement serialization
traits that map typed Rust values into Arrow arrays. The generic
RecordingStream::log<AS: AsComponents + ?Sized> accepts built-ins, custom
bundles, and trait objects through the same API.
AsComponents is deliberately object-safe. Arrays, Vec<AS>, references, and
Box<dyn AsComponents> flatten into Vec<SerializedComponentBatch>. That is
the erasure point: semantic identity remains in each ComponentDescriptor,
while concrete bundle shape no longer matters to batching or transport.
The viewer returns to strong types. Generic query and visualization helpers
such as process_archetype::<Points3D, _, _> use descriptors to request
required and optional components, then typed Arrow slicing exposes values like
[f32; 3], u32, or String.
Trait objects handle open runtime sets: Box<dyn LogSink>, visualizer systems,
data sources, and registries. Generics handle repeated algorithms whose concrete
types improve inference or representation. Code generation handles the large,
cross-language product schema that hand-written generic abstractions alone
would not keep consistent.