pub struct ModuleExports {
pub name: String,
pub description: String,
pub schemas: HashMap<String, ModuleFunction>,
pub export_visibility: HashMap<String, ModuleExportVisibility>,
pub shape_sources: Vec<(String, String)>,
pub module_artifacts: Vec<ModuleArtifact>,
pub method_intrinsics: HashMap<String, HashMap<String, ModuleFn>>,
pub type_schemas: Vec<TypeSchema>,
pub typed_exports: TypedModuleExports,
}Expand description
A Rust-implemented module exposed via <name>.
Fields§
§name: StringModule name (e.g., “csv”, “json”, “duckdb”)
description: StringHuman-readable description of this module
schemas: HashMap<String, ModuleFunction>Function schemas for LSP + validation: name → schema
export_visibility: HashMap<String, ModuleExportVisibility>Export visibility controls: name → visibility.
shape_sources: Vec<(String, String)>Shape source files bundled with this extension. Compiled and merged with core stdlib at startup. Vec of (filename, source_code) pairs.
Legacy compatibility field. New code should use module_artifacts.
module_artifacts: Vec<ModuleArtifact>Bundled module artifacts (source/compiled/both).
method_intrinsics: HashMap<String, HashMap<String, ModuleFn>>Method intrinsics for fast dispatch on typed Objects. Outer key: type name (e.g., “DuckDbQuery”) Inner key: method name (e.g., “build_sql”) Dispatched BEFORE callable-property and UFCS fallback.
type_schemas: Vec<TypeSchema>Type schemas to register in the VM’s runtime TypeSchemaRegistry. Extensions can use this to declare types that the runtime can use for TypedObject creation and field validation.
typed_exports: TypedModuleExportsTyped-return ABI registry (Phase 4b).
Authoritative registry for native-module function bodies. Every
export here declares its return type via
crate::typed_module_exports::TypedReturn / crate::typed_module_exports::ConcreteType;
the kind-threaded marshal layer projects the typed return into
a kinded slot at the dispatch boundary inside the VM, not in
the body (ADR-006 §2.7). Phase 4c.4 deleted the legacy
exports/async_exports ModuleFn parallel registry — every
callable function body lives here.
Implementations§
Source§impl ModuleExports
impl ModuleExports
Sourcepub fn typed_exports_mut(&mut self) -> &mut TypedModuleExports
pub fn typed_exports_mut(&mut self) -> &mut TypedModuleExports
Mutable access to the typed-return registry. Used by
crate::typed_module_exports::register_typed_function to record
the typed-body entry.
Sourcepub fn typed_exports(&self) -> &TypedModuleExports
pub fn typed_exports(&self) -> &TypedModuleExports
Read-only access to the typed-return registry.
Sourcepub fn add_schema_only(
&mut self,
name: impl Into<String>,
schema: ModuleFunction,
) -> &mut Self
pub fn add_schema_only( &mut self, name: impl Into<String>, schema: ModuleFunction, ) -> &mut Self
Register only the LSP/validation schema and visibility for an
exported name. The actual function body lives in typed_exports
and is dispatched directly via ModuleFnEntry::Typed /
ModuleFnEntry::TypedAsync — see
register_typed_function/register_typed_async_function and the
test-only register_test_function* helpers.
Sourcepub fn set_export_visibility(
&mut self,
name: impl Into<String>,
visibility: ModuleExportVisibility,
) -> &mut Self
pub fn set_export_visibility( &mut self, name: impl Into<String>, visibility: ModuleExportVisibility, ) -> &mut Self
Set visibility for one export name.
Sourcepub fn export_visibility(&self, name: &str) -> ModuleExportVisibility
pub fn export_visibility(&self, name: &str) -> ModuleExportVisibility
Resolve visibility for one export (defaults to Public).
Sourcepub fn is_export_available(&self, name: &str, comptime_mode: bool) -> bool
pub fn is_export_available(&self, name: &str, comptime_mode: bool) -> bool
Return true when the export can be called in the current compiler mode.
Sourcepub fn is_export_public_surface(&self, name: &str, comptime_mode: bool) -> bool
pub fn is_export_public_surface(&self, name: &str, comptime_mode: bool) -> bool
Return true when the export should appear in user-facing completion/hover surfaces.
Sourcepub fn export_names_available(&self, comptime_mode: bool) -> Vec<&str>
pub fn export_names_available(&self, comptime_mode: bool) -> Vec<&str>
List exports available for the requested mode (sync + async).
Sourcepub fn export_names_public_surface(&self, comptime_mode: bool) -> Vec<&str>
pub fn export_names_public_surface(&self, comptime_mode: bool) -> Vec<&str>
List user-facing exports for completion/hover (sync + async).
Sourcepub fn add_shape_source(&mut self, filename: &str, source: &str) -> &mut Self
pub fn add_shape_source(&mut self, filename: &str, source: &str) -> &mut Self
Bundle a Shape source file with this extension. The source will be compiled and merged with stdlib at startup.
Sourcepub fn add_shape_artifact(
&mut self,
module_path: impl Into<String>,
source: Option<String>,
compiled: Option<Vec<u8>>,
) -> &mut Self
pub fn add_shape_artifact( &mut self, module_path: impl Into<String>, source: Option<String>, compiled: Option<Vec<u8>>, ) -> &mut Self
Register a bundled module artifact (source/compiled/both).
Sourcepub fn add_intrinsic<F>(
&mut self,
type_name: &str,
method_name: &str,
f: F,
) -> &mut Selfwhere
F: for<'ctx> Fn(&[KindedSlot], &ModuleContext<'ctx>) -> Result<KindedSlot, String> + Send + Sync + 'static,
pub fn add_intrinsic<F>(
&mut self,
type_name: &str,
method_name: &str,
f: F,
) -> &mut Selfwhere
F: for<'ctx> Fn(&[KindedSlot], &ModuleContext<'ctx>) -> Result<KindedSlot, String> + Send + Sync + 'static,
Register a method intrinsic for fast dispatch on typed Objects. Called before callable-property and UFCS fallback in handle_object_method().
Sourcepub fn add_type_schema(&mut self, schema: TypeSchema) -> SchemaId
pub fn add_type_schema(&mut self, schema: TypeSchema) -> SchemaId
Register a type schema that the VM will add to its runtime registry. Returns the schema ID for reference.
Sourcepub fn has_export(&self, name: &str) -> bool
pub fn has_export(&self, name: &str) -> bool
Check if this module exports a given name (sync or async).
Sourcepub fn get_schema(&self, name: &str) -> Option<&ModuleFunction>
pub fn get_schema(&self, name: &str) -> Option<&ModuleFunction>
Get the schema for an exported function.
Sourcepub fn export_names(&self) -> Vec<&str>
pub fn export_names(&self) -> Vec<&str>
List all export names (sync + async).
Sourcepub fn to_parsed_schema(&self) -> ParsedModuleSchema
pub fn to_parsed_schema(&self) -> ParsedModuleSchema
Convert this module’s schema to a ParsedModuleSchema for the semantic
analyzer, mirroring the conversion in BytecodeExecutor::module_schemas().
Sourcepub fn stdlib_module_schemas() -> Vec<ParsedModuleSchema>
pub fn stdlib_module_schemas() -> Vec<ParsedModuleSchema>
Return ParsedModuleSchema entries for all shipped native stdlib modules.
Used during engine initialization to make these globals visible at compile time.