Skip to main content

Runtime

Struct Runtime 

Source
pub struct Runtime { /* private fields */ }

Implementations§

Source§

impl Runtime

Source

pub fn new(shell: Shell, python: Option<Box<dyn PythonEngine>>) -> Self

Source

pub fn reset_transient(&mut self)

Clears per-invocation control-flow signals. A stray exit/break/ continue (e.g. leaked from a script or function body) used to persist on the long-lived Runtime, so every later multi-command input ran only its first segment. Host entry points must call this before each command.

Source

pub fn execute_top(&mut self, input: &str) -> CommandOutput

Top-level command entry for hosts: resets leaked control-flow state, then executes. Nesting uses Self::execute directly.

Source

pub fn execute(&mut self, input: &str) -> CommandOutput

Top-level entry: splits the input into logical segments (newlines, ;, &&, ||, heredocs) and executes them with shell chaining semantics.

Source

pub fn execute_with_cwd(&mut self, cwd: &str, input: &str) -> CommandOutput

Executes input with cwd as the working directory, restoring the previous cwd afterwards. Used by hosts (e.g. the Android app UI) so concurrent callers don’t depend on — or pollute — the shared cwd.

Source§

impl Runtime

Source

pub fn python_available(&self) -> bool

Source

pub fn python_engine_ref(&self) -> Option<&(dyn PythonEngine + '_)>

Source

pub fn execute_python_code(&mut self, code: &str) -> CommandOutput

Source

pub fn execute_python_script(&mut self, script_path: &str) -> CommandOutput

Source

pub fn shell_root_dir(&self) -> PathBuf

Source

pub fn vfs_cwd(&self) -> PathBuf

Returns the VFS absolute path for the current working directory.

Source

pub fn cwd(&self) -> &str

Source

pub fn read_file(&self, path: &str) -> Result<String, String>

Source

pub fn write_file(&self, path: &str, content: &str) -> Result<(), String>

Source

pub fn list_dir(&self, path: &str) -> Result<Vec<FileEntry>, String>

Source

pub fn exists(&self, path: &str) -> bool

Source

pub fn is_dir(&self, path: &str) -> bool

Source

pub fn quick_execute(&mut self, command: &str) -> CommandOutput

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V