pub struct Runtime { /* private fields */ }Expand description
The main runtime engine for Shape
Implementations§
Source§impl Runtime
impl Runtime
pub fn annotation_registry(&self) -> Arc<RwLock<AnnotationRegistry>>
pub fn enable_persistent_context(&mut self, data: &DataFrame)
pub fn enable_persistent_context_without_data(&mut self)
pub fn set_persistent_context(&mut self, ctx: ExecutionContext)
pub fn persistent_context(&self) -> Option<&ExecutionContext>
pub fn persistent_context_mut(&mut self) -> Option<&mut ExecutionContext>
Sourcepub fn set_last_runtime_error(&mut self, payload: Option<WireValue>)
pub fn set_last_runtime_error(&mut self, payload: Option<WireValue>)
Store the last structured runtime error payload.
Sourcepub fn clear_last_runtime_error(&mut self)
pub fn clear_last_runtime_error(&mut self)
Clear any stored structured runtime error payload.
Sourcepub fn last_runtime_error(&self) -> Option<&WireValue>
pub fn last_runtime_error(&self) -> Option<&WireValue>
Borrow the last structured runtime error payload.
Sourcepub fn take_last_runtime_error(&mut self) -> Option<WireValue>
pub fn take_last_runtime_error(&mut self) -> Option<WireValue>
Take the last structured runtime error payload.
pub fn type_method_registry(&self) -> &Arc<TypeMethodRegistry>
Sourcepub fn module_binding_registry(&self) -> Arc<RwLock<ModuleBindingRegistry>>
pub fn module_binding_registry(&self) -> Arc<RwLock<ModuleBindingRegistry>>
Get the module-binding registry shared with VM/JIT execution.
Sourcepub fn add_module_path(&mut self, path: PathBuf)
pub fn add_module_path(&mut self, path: PathBuf)
Add a module search path for imports
This is useful when executing scripts - add the script’s directory to the module search paths for resolution.
Sourcepub fn set_keychain(&mut self, keychain: Keychain)
pub fn set_keychain(&mut self, keychain: Keychain)
Set the keychain for module signature verification.
Propagates to the module loader so it can verify module signatures at load time.
Sourcepub fn set_blob_store(&mut self, store: Arc<dyn BlobStore>)
pub fn set_blob_store(&mut self, store: Arc<dyn BlobStore>)
Set the blob store for content-addressed function blobs.
Propagates to the module loader so it can lazily fetch blobs not found in inline caches.
Sourcepub fn set_project_root(&mut self, root: &Path, extra_paths: &[PathBuf])
pub fn set_project_root(&mut self, root: &Path, extra_paths: &[PathBuf])
Set the project root and prepend its configured module paths
Sourcepub fn set_dependency_paths(&mut self, deps: HashMap<String, PathBuf>)
pub fn set_dependency_paths(&mut self, deps: HashMap<String, PathBuf>)
Set resolved dependency paths for the module loader
Sourcepub fn get_dependency_paths(&self) -> &HashMap<String, PathBuf>
pub fn get_dependency_paths(&self) -> &HashMap<String, PathBuf>
Get the resolved dependency paths from the module loader.
Sourcepub fn register_extension_module_artifacts(
&mut self,
modules: &[ParsedModuleSchema],
)
pub fn register_extension_module_artifacts( &mut self, modules: &[ParsedModuleSchema], )
Register extension-provided module artifacts into the unified module loader.
Sourcepub fn configured_module_loader(&self) -> ModuleLoader
pub fn configured_module_loader(&self) -> ModuleLoader
Build a fresh module loader with the same search/dependency settings.
This is used by external executors (VM/JIT) so import resolution stays aligned with runtime configuration.
Sourcepub fn load_core_stdlib_into_context(&mut self, data: &DataFrame) -> Result<()>
pub fn load_core_stdlib_into_context(&mut self, data: &DataFrame) -> Result<()>
Load std::core::* modules via the unified module loader and register them in runtime context.
This is the canonical stdlib bootstrap path used by the engine and CLI.
pub fn load_program( &mut self, program: &Program, data: &DataFrame, ) -> Result<()>
pub fn execute_query( &mut self, query: &Item, data: &DataFrame, ) -> Result<QueryResult>
pub fn execute_without_data(&mut self, item: &Item) -> Result<QueryResult>
Sourcepub fn format_value(
&mut self,
_value: Value,
type_name: &str,
format_name: Option<&str>,
_param_overrides: HashMap<String, Value>,
) -> Result<String>
pub fn format_value( &mut self, _value: Value, type_name: &str, format_name: Option<&str>, _param_overrides: HashMap<String, Value>, ) -> Result<String>
Format a value using Shape format definitions from stdlib
Currently a placeholder until VM-based format execution is implemented.
Sourcepub fn set_debug_mode(&mut self, enabled: bool)
pub fn set_debug_mode(&mut self, enabled: bool)
Enable or disable debug mode.
When enabled, the runtime produces verbose tracing output via tracing
and enables any debug-only code paths in the executor.
Sourcepub fn debug_mode(&self) -> bool
pub fn debug_mode(&self) -> bool
Query whether debug mode is active.
Sourcepub fn set_execution_timeout(&mut self, timeout: Duration)
pub fn set_execution_timeout(&mut self, timeout: Duration)
Set the maximum wall-clock duration for a single execution.
The executor can periodically check elapsed time against this limit and abort with a timeout error if exceeded.
Sourcepub fn execution_timeout(&self) -> Option<Duration>
pub fn execution_timeout(&self) -> Option<Duration>
Query the configured execution timeout, if any.
Sourcepub fn set_memory_limit(&mut self, limit: usize)
pub fn set_memory_limit(&mut self, limit: usize)
Set a memory limit (in bytes) for the runtime.
Allocation tracking can reference this value to decide when to refuse new allocations or trigger garbage collection.
Sourcepub fn memory_limit(&self) -> Option<usize>
pub fn memory_limit(&self) -> Option<usize>
Query the configured memory limit, if any.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Runtime
impl !RefUnwindSafe for Runtime
impl Send for Runtime
impl Sync for Runtime
impl Unpin for Runtime
impl UnsafeUnpin for Runtime
impl !UnwindSafe for Runtime
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> 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