pub struct ModuleExports {
pub name: String,
pub description: String,
pub exports: HashMap<String, ModuleFn>,
pub async_exports: HashMap<String, AsyncModuleFn>,
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>,
}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
exports: HashMap<String, ModuleFn>Exported sync functions: name → implementation
async_exports: HashMap<String, AsyncModuleFn>Exported async functions: name → implementation
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.
Implementations§
Source§impl ModuleExports
impl ModuleExports
Sourcepub fn add_function<F>(&mut self, name: impl Into<String>, f: F) -> &mut Self
pub fn add_function<F>(&mut self, name: impl Into<String>, f: F) -> &mut Self
Register an exported function.
Sourcepub fn add_function_with_schema<F>(
&mut self,
name: impl Into<String>,
f: F,
schema: ModuleFunction,
) -> &mut Self
pub fn add_function_with_schema<F>( &mut self, name: impl Into<String>, f: F, schema: ModuleFunction, ) -> &mut Self
Register an exported function with its schema.
Sourcepub fn add_async_function<F, Fut>(
&mut self,
name: impl Into<String>,
f: F,
) -> &mut Self
pub fn add_async_function<F, Fut>( &mut self, name: impl Into<String>, f: F, ) -> &mut Self
Register an async exported function.
Sourcepub fn add_async_function_with_schema<F, Fut>(
&mut self,
name: impl Into<String>,
f: F,
schema: ModuleFunction,
) -> &mut Self
pub fn add_async_function_with_schema<F, Fut>( &mut self, name: impl Into<String>, f: F, schema: ModuleFunction, ) -> &mut Self
Register an async exported function with its schema.
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 Self
pub fn add_intrinsic<F>( &mut self, type_name: &str, method_name: &str, f: F, ) -> &mut Self
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_export(&self, name: &str) -> Option<&ModuleFn>
pub fn get_export(&self, name: &str) -> Option<&ModuleFn>
Get a sync exported function by name.
Sourcepub fn get_async_export(&self, name: &str) -> Option<&AsyncModuleFn>
pub fn get_async_export(&self, name: &str) -> Option<&AsyncModuleFn>
Get an async exported function by name.
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.
Trait Implementations§
Source§impl Clone for ModuleExports
impl Clone for ModuleExports
Source§fn clone(&self) -> ModuleExports
fn clone(&self) -> ModuleExports
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ModuleExports
impl !RefUnwindSafe for ModuleExports
impl Send for ModuleExports
impl Sync for ModuleExports
impl Unpin for ModuleExports
impl UnsafeUnpin for ModuleExports
impl !UnwindSafe for ModuleExports
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more