pub struct Runtime { /* private fields */ }Implementations§
Source§impl Runtime
impl Runtime
pub fn invoke_hta( &mut self, qualified_var: &str, arguments_hta: &[u8], ) -> Result<Vec<u8>, InvokeHtaError>
§impl Runtime
impl Runtime
pub fn new() -> Runtime
pub fn core() -> Runtime
pub fn core() -> Runtime
Creates the portable core-language evaluator without loading the language-level foundation. This is useful for small embedded surfaces whose commands only require core forms and should become interactive immediately.
pub fn set_test_runner(&mut self, runner: &str) -> Result<(), JsValue>
pub fn set_execution_backend(&mut self, backend: &str) -> Result<(), JsValue>
pub fn set_execution_backend(&mut self, backend: &str) -> Result<(), JsValue>
Selects the execution backend used by ordinary eval and Session
evaluation. The default is interpreter; direct-native is an
explicit native-target opt-in and never falls back to interpretation.
pub fn execution_backend(&self) -> String
pub fn execution_backend(&self) -> String
Returns the selected ordinary evaluation backend.
pub fn eval_halc(&mut self, bytes: &[u8]) -> Result<String, String>
pub fn create_namespace(&mut self, name: &str) -> bool
pub fn use_namespace(&mut self, name: &str) -> bool
pub fn visible_symbols(&self) -> Vec<String>
pub fn current_namespace(&self) -> String
pub fn alias_namespace(&mut self, alias: &str, target: &str) -> bool
pub fn resolve_namespace(&self, name: &str) -> String
pub fn eval_in_namespace(
&mut self,
name: &str,
source: &str,
) -> Result<String, JsValue>
pub fn eval_in_namespace( &mut self, name: &str, source: &str, ) -> Result<String, JsValue>
Evaluates source after selecting a namespace.
pub fn require_resource_in_namespace( &mut self, resource: &str, namespace: &str, ) -> Result<String, JsValue>
pub fn install_memory_file_provider(&mut self, root: &str)
pub fn install_native_file_provider(&mut self, root: &str)
pub fn install_native_socket_provider(&mut self)
pub fn install_native_process_provider(&mut self)
pub fn install_loopback_socket_provider(&mut self)
pub fn file_resolve(&self, root: &str, path: &str) -> Result<String, JsValue>
pub fn file_read(&self, path: &str) -> Result<PromiseHandle, JsValue>
pub fn file_write( &self, path: &str, bytes: Vec<u8>, ) -> Result<PromiseHandle, JsValue>
pub fn file_exists(&self, path: &str) -> Result<PromiseHandle, JsValue>
pub fn file_stat(&self, path: &str) -> Result<PromiseHandle, JsValue>
pub fn file_list(&self, path: &str) -> Result<PromiseHandle, JsValue>
pub fn file_mkdir(&self, path: &str) -> Result<PromiseHandle, JsValue>
pub fn file_walk(&self, path: &str) -> Result<PromiseHandle, JsValue>
pub fn file_delete(&self, path: &str) -> Result<PromiseHandle, JsValue>
pub fn extension_available(&self, name: &str) -> bool
pub fn require_extension(&mut self, name: &str) -> Result<String, JsValue>
pub fn register_resource(&mut self, name: &str, source: &str)
pub fn register_resource(&mut self, name: &str, source: &str)
Registers a host-supplied Hara resource. Resources are source text, not executable host code.
pub fn unregister_resource(&mut self, name: &str) -> Result<(), JsValue>
pub fn unregister_resource(&mut self, name: &str) -> Result<(), JsValue>
Detaches a host-supplied namespace while leaving already captured values alive. Package providers use this to deactivate one generation.
pub fn register_package_lock(&mut self, source: &str) -> Result<(), JsValue>
pub fn register_package_lock(&mut self, source: &str) -> Result<(), JsValue>
Registers exact package ownership from project.lock.edn without downloading or loading any namespace.
pub fn load_resource(&mut self, name: &str) -> Result<String, JsValue>
pub fn load_resource(&mut self, name: &str) -> Result<String, JsValue>
Evaluates a registered resource in the current lexical namespace.
pub fn require_resource(&mut self, name: &str) -> Result<String, JsValue>
pub fn require_resource(&mut self, name: &str) -> Result<String, JsValue>
Loads a resource once; subsequent requires return the current loaded marker.
pub fn file_supported(&self) -> bool
pub fn socket_supported(&self) -> bool
pub fn socket_connect(&self, host: &str, port: u16) -> Result<u64, JsValue>
pub fn socket_connect(&self, host: &str, port: u16) -> Result<u64, JsValue>
Opens a callback-based socket and returns its provider-owned handle.
pub fn socket_send(&self, socket: u64, bytes: Vec<u8>) -> Result<usize, JsValue>
pub fn socket_close(&self, socket: u64) -> Result<(), JsValue>
pub fn has_protocol_method(&self, protocol: &str, method: &str) -> bool
pub fn has_protocol_method(&self, protocol: &str, method: &str) -> bool
Returns whether a protocol method is registered in this runtime context.
pub fn eval(&mut self, source: &str) -> Result<String, JsValue>
pub fn eval_traced(&mut self, source: &str) -> Result<String, JsValue>
pub fn compile_bytecode_artifact_js( &self, source: &str, ) -> Result<Vec<u8>, JsValue>
pub fn compile_bytecode_manifest_js(
&self,
source: &str,
) -> Result<String, JsValue>
pub fn compile_bytecode_manifest_js( &self, source: &str, ) -> Result<String, JsValue>
Returns the immutable manifest for the HBC0 artifact produced from
source. Hosts can cache the bytes and manifest without guessing the
target or ABI from a filename.
pub fn eval_bytecode_artifact_js( &mut self, bytes: &[u8], ) -> Result<String, JsValue>
pub fn eval_bytecode_bundle_js(&mut self, bytes: &[u8]) -> Result<(), JsValue>
pub fn eval_bytecode_bundle_js(&mut self, bytes: &[u8]) -> Result<(), JsValue>
Installs a verified HBX0 namespace bundle. The bundle indexes each
module’s bytecode without making package loading implicit; callers
still choose when to require a registered namespace.
pub fn eval_native(&mut self, source: &str) -> Result<String, String>
pub fn eval_native_traced(&mut self, source: &str) -> Result<String, String>
§impl Runtime
impl Runtime
pub fn eval_native_diagnostic(
&mut self,
source: &str,
) -> ((Result<String, String>, Vec<TraceFrame>), Option<Value>)
pub fn eval_native_diagnostic( &mut self, source: &str, ) -> ((Result<String, String>, Vec<TraceFrame>), Option<Value>)
Evaluates native source while retaining the typed exception and callable
frames needed by embedding protocols. The ordinary eval_native and
eval_native_traced string contracts remain unchanged.
pub fn register_source_catalog(&mut self, catalog: &SourceCatalog)
pub fn register_source_catalog(&mut self, catalog: &SourceCatalog)
Replaces the native project source catalog used by namespace loading. Only paths are retained; source bodies are read at the require boundary. Existing in-memory resources and bytecode remain higher priority than the mounted paths.
pub fn clear_source_catalog(&mut self)
pub fn clear_source_catalog(&mut self)
Detaches every mounted native project source path and removes its source-only namespace state. Materialized source namespaces are intentionally discarded at this explicit teardown boundary.
pub fn bootstrap_source_foundation(&mut self) -> Result<(), String>
pub fn bootstrap_source_foundation(&mut self) -> Result<(), String>
Loads the language-level Foundation from the mounted source catalog. This is intentionally an interpreter bootstrap: the resulting macros, aliases, and protocol wiring form the compiler environment for later direct-native namespace loads.
§impl Runtime
impl Runtime
pub fn with_native_engine(engine: NativeEngine) -> Self
pub fn with_native_engine(engine: NativeEngine) -> Self
Creates a Runtime whose native-substrate telemetry is shared with another Runtime owner. Namespace registries, providers, and mutable Hara state remain owned by each Runtime; bytecode program images remain owned by the execution that prepared them.
pub fn native_execution_telemetry(&self) -> NativeExecutionTelemetry
pub fn native_execution_telemetry(&self) -> NativeExecutionTelemetry
Returns cumulative counters from the Runtime-owned bytecode VM and
native-substrate boundary. The counters belong to the reusable native
engine and are not cleared merely by switching the selected backend;
callers sharing an engine can explicitly call
crate::direct_native::NativeEngine::reset at their lifecycle
boundary.
Source§impl Runtime
impl Runtime
Sourcepub fn install_native_kernel_provider(&mut self, provider: Rc<KernelProvider>)
pub fn install_native_kernel_provider(&mut self, provider: Rc<KernelProvider>)
Installs the typed native driver behind std.native.Kernel/*.
Sourcepub fn install_native_host_handler(
&mut self,
handler: Rc<dyn Fn(String, String, Vec<Value>) -> Result<Value, String>>,
)
pub fn install_native_host_handler( &mut self, handler: Rc<dyn Fn(String, String, Vec<Value>) -> Result<Value, String>>, )
Installs the native host service handler used by std.native.Host/call.
Embedders can expose process-local services without converting values
through JavaScript or textual serialization.
Sourcepub fn install_native_module(
&mut self,
module: Arc<dyn NativeModule>,
) -> Result<(), String>
pub fn install_native_module( &mut self, module: Arc<dyn NativeModule>, ) -> Result<(), String>
Installs a publication-linked native ABI module and exposes it through the same promise-returning Host/call boundary used by browser embedders.
pub fn native_module_services(&self) -> Vec<String>
Source§impl Runtime
impl Runtime
Sourcepub fn compile_bytecode(&self, source: &str) -> Result<Rc<Program>, String>
pub fn compile_bytecode(&self, source: &str) -> Result<Rc<Program>, String>
Compiles source against this runtime’s namespace registry: std.foundation vars and anything already interned are visible to the compiler’s two-phase global check (issue #223). The program is validated but not executed; globals intern only at execution.
Sourcepub fn execute_compiled_bytecode(
&mut self,
program: Rc<Program>,
) -> Result<String, String>
pub fn execute_compiled_bytecode( &mut self, program: Rc<Program>, ) -> Result<String, String>
Executes an already compiled program against this runtime’s namespace registry. Embedding hosts use this for prepare-once/call-many paths without decoding an artifact or rebuilding the program on every call.
Sourcepub fn execute_compiled_bytecode_value(
&mut self,
program: Rc<Program>,
) -> Result<Value, String>
pub fn execute_compiled_bytecode_value( &mut self, program: Rc<Program>, ) -> Result<Value, String>
Executes an already compiled program and returns its immutable runtime value directly. This avoids display serialization and lets native hosts inspect persistent results through their shared representation.
Sourcepub fn execute_compiled_bytecode_registry_value(
&mut self,
program: Rc<Program>,
) -> Result<Value, String>
pub fn execute_compiled_bytecode_registry_value( &mut self, program: Rc<Program>, ) -> Result<Value, String>
Executes a prepared program directly against the namespace registry, without copying bindings into the compatibility environment per call.
Sourcepub fn eval_bytecode_native(&mut self, source: &str) -> Result<String, String>
pub fn eval_bytecode_native(&mut self, source: &str) -> Result<String, String>
Compiles and executes through the experimental VM against this
runtime’s registry, then syncs the flat env so later eval_native
calls see the vars the program interned. No fallback: unsupported
forms fail as compile errors. eval_native is unaffected.
Sourcepub fn execute_compiled_direct_native(
&mut self,
program: Rc<Program>,
) -> Result<NativeExecutionReport, String>
pub fn execute_compiled_direct_native( &mut self, program: Rc<Program>, ) -> Result<NativeExecutionReport, String>
Executes a validated program through the opt-in bytecode VM plus native-substrate boundary. Ordinary Hara functions remain VM-owned; only the closed native/protocol/evaluator target inventory crosses into Rust callouts.
Sourcepub fn eval_direct_native(&mut self, source: &str) -> Result<String, String>
pub fn eval_direct_native(&mut self, source: &str) -> Result<String, String>
Compiles and executes source through the bytecode VM/native-substrate backend. Compilation-time namespace preparation and macro expansion retain their existing evaluator seam; no evaluator call is permitted once the validated program enters the native backend.
Sourcepub fn compile_bytecode_artifact(&self, source: &str) -> Result<Vec<u8>, String>
pub fn compile_bytecode_artifact(&self, source: &str) -> Result<Vec<u8>, String>
Compiles against this runtime’s namespaces and persists the validated program for later native or browser execution.
Sourcepub fn compile_halc_bytecode_artifact(
&mut self,
bytes: &[u8],
) -> Result<Vec<u8>, String>
pub fn compile_halc_bytecode_artifact( &mut self, bytes: &[u8], ) -> Result<Vec<u8>, String>
Lowers a HALC module directly to persistent bytecode. No source text is reconstructed, and the module’s normalized schema graph is embedded in the HBC artifact for later inference and specialization tiers.
§impl Runtime
impl Runtime
pub fn halc_schema(&self, qualified_var: &str) -> Option<&Form>
pub fn halc_schema(&self, qualified_var: &str) -> Option<&Form>
Returns the canonical schema value loaded from HALC for a named schema Var.
pub fn halc_function_schema(&self, qualified_var: &str) -> Option<&Form>
pub fn halc_function_schema(&self, qualified_var: &str) -> Option<&Form>
Returns the canonical schema annotation loaded from HALC for a function Var.
pub fn halc_schema_type(&self, qualified_var: &str) -> Option<&SchemaType>
pub fn halc_schema_type(&self, qualified_var: &str) -> Option<&SchemaType>
Returns the normalized compiler type for a named schema Var.
pub fn halc_inferred_function_type(
&self,
qualified_var: &str,
) -> Option<&SchemaType>
pub fn halc_inferred_function_type( &self, qualified_var: &str, ) -> Option<&SchemaType>
Returns a conservative body-derived function signature, when the compiler could prove one independently of the declared contract.
pub fn halc_function_type(&self, qualified_var: &str) -> Option<&SchemaType>
pub fn halc_function_type(&self, qualified_var: &str) -> Option<&SchemaType>
Returns a function’s normalized annotation, resolving one named edge.
pub fn eval_native_value(&mut self, source: &str) -> Result<Value, String>
pub fn eval_native_value(&mut self, source: &str) -> Result<Value, String>
Evaluates native Hara source and returns its runtime value without a display round trip. Embedding hosts use this to inspect declarative values containing Vars, functions, bytes, and persistent collections.
pub fn add_extension_root(&mut self, root: impl Into<PathBuf>)
pub fn install_wasm_extension<P: WasmExtensionProvider + 'static>( &mut self, manifest_source: &str, origin: &str, provider: P, ) -> Result<(), String>
pub fn install_direct_wasm_import(
&mut self,
logical: &str,
bytes: &[u8],
) -> Result<(), String>
pub fn install_direct_wasm_import( &mut self, logical: &str, bytes: &[u8], ) -> Result<(), String>
Installs one package-verified raw WASM module behind a logical import
coordinate. :import binds its exports directly and never creates an
HTA or generated Hara namespace.
pub fn cancel_wasm_extension( &self, name: &str, request: u64, ) -> Result<(), String>
Trait Implementations§
Source§impl FromWasmAbi for Runtime
impl FromWasmAbi for Runtime
Source§impl IntoWasmAbi for Runtime
impl IntoWasmAbi for Runtime
Source§impl LongRefFromWasmAbi for Runtime
impl LongRefFromWasmAbi for Runtime
Source§impl OptionFromWasmAbi for Runtime
impl OptionFromWasmAbi for Runtime
Source§impl OptionIntoWasmAbi for Runtime
impl OptionIntoWasmAbi for Runtime
Source§impl RefFromWasmAbi for Runtime
impl RefFromWasmAbi for Runtime
Source§type Abi = WasmPtr<WasmRefCell<Runtime>>
type Abi = WasmPtr<WasmRefCell<Runtime>>
Self are recovered from.Source§impl RefMutFromWasmAbi for Runtime
impl RefMutFromWasmAbi for Runtime
impl SupportsConstructor for Runtime
impl SupportsInstanceProperty for Runtime
impl SupportsStaticProperty for Runtime
Source§impl TryFromJsValue for Runtime
impl TryFromJsValue for Runtime
Source§impl VectorFromWasmAbi for Runtime
impl VectorFromWasmAbi for Runtime
Source§impl VectorIntoWasmAbi for Runtime
impl VectorIntoWasmAbi for Runtime
Auto Trait Implementations§
impl !Freeze for Runtime
impl !RefUnwindSafe for Runtime
impl !Send for Runtime
impl !Sync for Runtime
impl !UnwindSafe for Runtime
impl Unpin for Runtime
impl UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreimpl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.