Expand description
Type Schema Registry for JIT Type Specialization
This module provides compile-time type information for optimizing field access in the JIT compiler. When the type of an object is known, we can generate direct memory access instead of HashMap lookups.
§Overview
TypeSchema- Describes the layout of a declared typeFieldDef- Defines a single field with name, type, and offsetTypeSchemaRegistry- Global registry of all known type schemas
§Performance
Direct field access: ~2ns vs HashMap lookup: ~25ns (12x faster)
§Intersection Types
Supports merging multiple schemas for intersection types (A + B).
Field collisions are detected at compile time and result in errors.
Re-exports§
pub use builtin_schemas::BuiltinSchemaIds;pub use current::SyncRegistryScope;pub use current::current_registry;pub use current::default_registry;pub use current::try_current_registry;pub use current::with_async_scope;pub use enum_support::EnumInfo;pub use enum_support::EnumVariantInfo;pub use enum_support::EnumVariantKind;pub use field_types::FieldAnnotation;pub use field_types::FieldDef;pub use field_types::FieldType;pub use physical_binding::PhysicalSchemaBinding;pub use registry::TypeSchemaBuilder;pub use registry::TypeSchemaRegistry;pub use schema::TypeBinding;pub use schema::TypeBindingError;pub use schema::TypeSchema;
Modules§
- builtin_
schemas - Builtin schema definitions for fixed-layout runtime objects.
- current
- Task-local “current”
TypeSchemaRegistryhandle. - enum_
support - Enum type support for type schemas
- field_
types - Field type definitions for type schemas
- intersection
- Intersection type support for type schemas
- physical_
binding - Physical schema binding for direct Arrow buffer access.
- registry
- Type schema registry and builder
- schema
- Core TypeSchema struct and methods
Enums§
- Schema
Error - Error type for schema operations
- Typed
Field Value
Functions§
- ensure_
next_ schema_ id_ above - Ensure all future schema IDs from the current ambient registry are
strictly greater than
max_existing_id. - lookup_
schema_ by_ id_ public - Public wrapper for looking up a schema by ID across all registries (stdlib + predeclared). Used by wire_conversion when Context registry doesn’t have the schema (e.g. ad-hoc/const-eval objects).
- register_
predeclared_ any_ schema - Register a predeclared schema with
FieldType::Anyfor the given ordered fields. - typed_
object_ from_ pairs - Create a
KindedSlotcarrying aHeapValue::TypedObjectfrom a list of(name, KindedSlot)field pairs. - typed_
object_ to_ hashmap_ nb - Convert a TypedObject
KindedSlotback to aHashMap<String, KindedSlot>.
Type Aliases§
- Schema
Id - Unique identifier for a type schema