Skip to main content

ZshrsHost

Struct ZshrsHost 

Source
pub struct ZshrsHost;
Expand description

ShellHost implementation that delegates to the current ShellExecutor via the with_executor thread-local.

Construct fresh on each VM run (it carries no state itself). The VM dispatches host method calls during vm.run(), and with_executor resolves to the executor pointer set by ExecutorContext::enter.

Trait Implementations§

Source§

impl ShellHost for ZshrsHost

Source§

fn glob(&mut self, pattern: &str, _recursive: bool) -> Vec<String>

Glob expand pattern. If recursive, treat ** as a recursive marker. Returns the matched paths (empty when no match — caller decides how to handle nullglob/nomatch options).
Source§

fn tilde_expand(&mut self, s: &str) -> String

Tilde expansion: ~ → $HOME, ~user → user’s home, ~+/~- → dir stack. Returns input unchanged if no expansion applies.
Source§

fn brace_expand(&mut self, s: &str) -> Vec<String>

Brace expansion: {a,b} → [“a”,“b”], {1..10} → 10 strings. Returns a single-element vec containing the input when no braces present.
Source§

fn str_match(&mut self, s: &str, pattern: &str) -> bool

Glob match: does s match the shell glob pattern pat? Used by [[ x = pat ]] and case. Default is exact equality.
Source§

fn expand_param(&mut self, name: &str, modifier: u8, args: &[Value]) -> Value

Parameter expansion: ${var:-default}, ${#var}, ${var/pat/rep}, etc. modifier is one of crate::op::param_mod::*. args are the modifier operands (already evaluated to Values) — for ${var:-x} it’s [x], for ${var/p/r} it’s [p, r], for ${var:o:l} it’s [o, l]. LENGTH/UPPER/LOWER/KEYS/INDIRECT take no args.
Source§

fn regex_match(&mut self, s: &str, regex: &str) -> bool

Regex match: s =~ regex (extended POSIX or PCRE per host).
Source§

fn process_sub_in(&mut self, sub: &Chunk) -> String

Process substitution input: spawn sub, return path to a fd/FIFO that reads its stdout. (<(cmd))
Source§

fn process_sub_out(&mut self, sub: &Chunk) -> String

Process substitution output: spawn sub, return path to a fd/FIFO that writes to its stdin. (>(cmd))
Source§

fn subshell_begin(&mut self)

Begin subshell scope (snapshot/save state).
Source§

fn subshell_end(&mut self)

End subshell scope (restore state).
Source§

fn redirect(&mut self, fd: u8, op: u8, target: &str)

Apply a redirection at the next exec/builtin call. fd is the source fd, op from crate::op::redirect_op::*, target is the (already-expanded) filename or fd reference.
Source§

fn with_redirects_begin(&mut self, count: u8)

Begin scoped redirect block — cmd > out.txt style applied to a compound command. The host saves current fd state.
Source§

fn with_redirects_end(&mut self)

End scoped redirect block — restore fd state.
Source§

fn heredoc(&mut self, content: &str)

Heredoc body for the next command’s stdin.
Source§

fn herestring(&mut self, content: &str)

Herestring body for the next command’s stdin.
Source§

fn exec(&mut self, args: Vec<String>) -> i32

Spawn an external command and wait. Default uses std::process::Command.
Source§

fn cmd_subst(&mut self, sub: &Chunk) -> String

Run a sub-chunk and capture its stdout as a string. ($(cmd),`cmd`)
Source§

fn call_function(&mut self, name: &str, args: Vec<String>) -> Option<i32>

Call a user-defined shell function. Returns Some(status) when the function exists, None to fall through to external exec.
Source§

fn word_split(&mut self, s: &str) -> Vec<String>

Word splitting using current IFS rules.
Source§

fn array_index(&mut self, name: &str, index: &Value) -> Value

Index into an array variable: ${arr[idx]}. index is the evaluated subscript (Int for indexed arrays, Str for associative).
Source§

fn pipeline_begin(&mut self, n: u8)

Begin an N-stage pipeline. Subsequent pipeline_stage calls separate stages; pipeline_end waits for completion and returns final status.
Source§

fn pipeline_stage(&mut self)

Wire next pipeline stage (set up pipe between previous and next).
Source§

fn pipeline_end(&mut self) -> i32

Wait for the pipeline to complete; return last command’s exit status.
Source§

fn trap_set(&mut self, sig: &str, handler: &Chunk)

Install a trap handler for signal sig. The handler is a sub-chunk that the host runs when the signal fires.
Source§

fn trap_check(&mut self)

Process pending traps (called periodically by the VM dispatch loop).
Source§

fn exec_bg(&mut self, args: Vec<String>) -> i32

Spawn an external command in the background and detach. Returns the child pid (or 0 on failure / when the host doesn’t track pids). Default uses std::process::Command::spawn(). Frontends override to register the pid in their job table so jobs, fg, wait, disown see it.

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
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> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
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<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

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

Source§

fn vzip(self) -> V

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