Skip to main content

Module type_schema

Module type_schema 

Source
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 type
  • FieldDef - Defines a single field with name, type, and offset
  • TypeSchemaRegistry - 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” TypeSchemaRegistry handle.
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§

SchemaError
Error type for schema operations
TypedFieldValue

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::Any for the given ordered fields.
typed_object_from_pairs
Create a KindedSlot carrying a HeapValue::TypedObject from a list of (name, KindedSlot) field pairs.
typed_object_to_hashmap_nb
Convert a TypedObject KindedSlot back to a HashMap<String, KindedSlot>.

Type Aliases§

SchemaId
Unique identifier for a type schema