Skip to main content

RunMatSession

Struct RunMatSession 

Source
pub struct RunMatSession { /* private fields */ }
Expand description

Host-agnostic RunMat execution session (parser + interpreter + optional JIT).

Implementations§

Source§

impl RunMatSession

Source§

impl RunMatSession

Source

pub fn new() -> Result<Self>

Create a new session

Source

pub fn with_options(enable_jit: bool, verbose: bool) -> Result<Self>

Create a new session with specific options

Source

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

Source

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)

Source

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.

Source

pub fn clear_async_input_handler(&mut self)

Source

pub fn telemetry_client_id(&self) -> Option<&str>

Source

pub fn set_telemetry_client_id(&mut self, cid: Option<String>)

Source

pub fn cancel_execution(&self)

Request cooperative cancellation for the currently running execution.

Source

pub fn interrupt_handle(&self) -> Arc<AtomicBool>

Shared interrupt flag used by the VM to implement cooperative cancellation.

Source

pub fn snapshot_info(&self) -> Option<String>

Get snapshot information

Source

pub fn has_snapshot(&self) -> bool

Check if a snapshot is loaded

Source

pub fn compile_fusion_plan( &mut self, input: &str, ) -> Result<Option<FusionPlanSnapshot>, RunError>

Compile the input and produce a fusion plan snapshot without executing.

Source

pub async fn execute( &mut self, input: &str, ) -> Result<ExecutionResult, RunError>

Execute MATLAB/Octave code

Source

pub async fn run(&mut self, input: &str) -> Result<ExecutionResult, RunError>

Parse, lower, compile, and execute input.

Source

pub fn stats(&self) -> &ExecutionStats

Get execution statistics

Source

pub fn reset_stats(&mut self)

Reset execution statistics

Source

pub fn clear_variables(&mut self)

Clear all variables in the session context

Source

pub async fn export_workspace_state( &mut self, mode: WorkspaceExportMode, ) -> Result<Option<Vec<u8>>>

Source

pub fn import_workspace_state(&mut self, bytes: &[u8]) -> Result<()>

Source

pub fn workspace_snapshot(&mut self) -> WorkspaceSnapshot

Source

pub fn set_emit_fusion_plan(&mut self, enabled: bool)

Control whether fusion plan snapshots are emitted in ExecutionResult.

Source

pub fn compat_mode(&self) -> CompatMode

Return the active language compatibility mode.

Source

pub fn set_compat_mode(&mut self, mode: CompatMode)

Set the language compatibility mode (matlab or strict).

Source

pub fn set_callstack_limit(&mut self, limit: usize)

Source

pub fn set_error_namespace(&mut self, namespace: impl Into<String>)

Source

pub fn set_source_name_override(&mut self, name: Option<String>)

Source

pub async fn materialize_variable( &mut self, target: WorkspaceMaterializeTarget, options: WorkspaceMaterializeOptions, ) -> Result<MaterializedVariable>

Materialize a workspace variable for inspection (optionally identified by preview token).

Source

pub fn get_variables(&self) -> &HashMap<String, Value>

Get a copy of current variables

Source

pub fn configure_gc(&self, config: GcConfig) -> Result<()>

Configure garbage collector

Source

pub fn gc_stats(&self) -> GcStats

Get GC statistics

Source

pub fn show_system_info(&self)

Show detailed system information

Trait Implementations§

Source§

impl Default for RunMatSession

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> WasmNotSend for T
where T: Send,