pub struct RunMatSession { /* private fields */ }Expand description
Host-agnostic RunMat execution session (parser + interpreter + optional JIT).
Implementations§
Source§impl RunMatSession
impl RunMatSession
pub fn set_telemetry_sink(&mut self, sink: Option<Arc<dyn TelemetrySink>>)
pub fn set_telemetry_platform_info(&mut self, platform: TelemetryPlatformInfo)
pub fn telemetry_platform_info(&self) -> &TelemetryPlatformInfo
pub fn telemetry_run( &self, config: TelemetryRunConfig, ) -> Option<TelemetryRunGuard>
Source§impl RunMatSession
impl RunMatSession
Sourcepub fn with_options(enable_jit: bool, verbose: bool) -> Result<Self>
pub fn with_options(enable_jit: bool, verbose: bool) -> Result<Self>
Create a new session with specific options
Sourcepub fn with_snapshot<P: AsRef<Path>>(
enable_jit: bool,
verbose: bool,
snapshot_path: Option<P>,
) -> Result<Self>
pub fn with_snapshot<P: AsRef<Path>>( enable_jit: bool, verbose: bool, snapshot_path: Option<P>, ) -> Result<Self>
Create a new session with snapshot loading
Sourcepub fn with_snapshot_bytes(
enable_jit: bool,
verbose: bool,
snapshot_bytes: Option<&[u8]>,
) -> Result<Self>
pub fn with_snapshot_bytes( enable_jit: bool, verbose: bool, snapshot_bytes: Option<&[u8]>, ) -> Result<Self>
Create a session using snapshot bytes (already fetched from disk or network)
Sourcepub fn install_async_input_handler<F, Fut>(&mut self, handler: F)where
F: Fn(InputRequest) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<InputResponse, String>> + 'static,
pub fn install_async_input_handler<F, Fut>(&mut self, handler: F)where
F: Fn(InputRequest) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<InputResponse, String>> + 'static,
Install an async stdin handler (Phase 2). This is the preferred input path for
poll-driven execution (ExecuteFuture).
The handler is invoked when input() / pause() needs a line or keypress, and the
returned future is awaited by the runtime.
pub fn clear_async_input_handler(&mut self)
pub fn telemetry_consent(&self) -> bool
pub fn set_telemetry_consent(&mut self, consent: bool)
pub fn telemetry_client_id(&self) -> Option<&str>
pub fn set_telemetry_client_id(&mut self, cid: Option<String>)
Sourcepub fn cancel_execution(&self)
pub fn cancel_execution(&self)
Request cooperative cancellation for the currently running execution.
Sourcepub fn interrupt_handle(&self) -> Arc<AtomicBool> ⓘ
pub fn interrupt_handle(&self) -> Arc<AtomicBool> ⓘ
Shared interrupt flag used by the VM to implement cooperative cancellation.
Sourcepub fn snapshot_info(&self) -> Option<String>
pub fn snapshot_info(&self) -> Option<String>
Get snapshot information
Sourcepub fn has_snapshot(&self) -> bool
pub fn has_snapshot(&self) -> bool
Check if a snapshot is loaded
Sourcepub fn compile_fusion_plan(
&mut self,
input: &str,
) -> Result<Option<FusionPlanSnapshot>, RunError>
pub fn compile_fusion_plan( &mut self, input: &str, ) -> Result<Option<FusionPlanSnapshot>, RunError>
Compile the input and produce a fusion plan snapshot without executing.
Sourcepub async fn execute(
&mut self,
input: &str,
) -> Result<ExecutionResult, RunError>
pub async fn execute( &mut self, input: &str, ) -> Result<ExecutionResult, RunError>
Execute MATLAB/Octave code
Sourcepub async fn run(&mut self, input: &str) -> Result<ExecutionResult, RunError>
pub async fn run(&mut self, input: &str) -> Result<ExecutionResult, RunError>
Parse, lower, compile, and execute input.
Sourcepub fn stats(&self) -> &ExecutionStats
pub fn stats(&self) -> &ExecutionStats
Get execution statistics
Sourcepub fn reset_stats(&mut self)
pub fn reset_stats(&mut self)
Reset execution statistics
Sourcepub fn clear_variables(&mut self)
pub fn clear_variables(&mut self)
Clear all variables in the session context
pub async fn export_workspace_state( &mut self, mode: WorkspaceExportMode, ) -> Result<Option<Vec<u8>>>
pub fn import_workspace_state(&mut self, bytes: &[u8]) -> Result<()>
pub fn workspace_snapshot(&mut self) -> WorkspaceSnapshot
Sourcepub fn set_emit_fusion_plan(&mut self, enabled: bool)
pub fn set_emit_fusion_plan(&mut self, enabled: bool)
Control whether fusion plan snapshots are emitted in ExecutionResult.
Sourcepub fn compat_mode(&self) -> CompatMode
pub fn compat_mode(&self) -> CompatMode
Return the active language compatibility mode.
Sourcepub fn set_compat_mode(&mut self, mode: CompatMode)
pub fn set_compat_mode(&mut self, mode: CompatMode)
Set the language compatibility mode (matlab or strict).
pub fn set_callstack_limit(&mut self, limit: usize)
pub fn set_error_namespace(&mut self, namespace: impl Into<String>)
pub fn set_source_name_override(&mut self, name: Option<String>)
Sourcepub async fn materialize_variable(
&mut self,
target: WorkspaceMaterializeTarget,
options: WorkspaceMaterializeOptions,
) -> Result<MaterializedVariable>
pub async fn materialize_variable( &mut self, target: WorkspaceMaterializeTarget, options: WorkspaceMaterializeOptions, ) -> Result<MaterializedVariable>
Materialize a workspace variable for inspection (optionally identified by preview token).
Sourcepub fn get_variables(&self) -> &HashMap<String, Value>
pub fn get_variables(&self) -> &HashMap<String, Value>
Get a copy of current variables
Sourcepub fn configure_gc(&self, config: GcConfig) -> Result<()>
pub fn configure_gc(&self, config: GcConfig) -> Result<()>
Configure garbage collector
Sourcepub fn show_system_info(&self)
pub fn show_system_info(&self)
Show detailed system information
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RunMatSession
impl !RefUnwindSafe for RunMatSession
impl Send for RunMatSession
impl !Sync for RunMatSession
impl Unpin for RunMatSession
impl UnsafeUnpin for RunMatSession
impl !UnwindSafe for RunMatSession
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.