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
impl ShellHost for ZshrsHost
Source§fn glob(&mut self, pattern: &str, _recursive: bool) -> Vec<String>
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
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>
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
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
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
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
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
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)
fn subshell_begin(&mut self)
Begin subshell scope (snapshot/save state).
Source§fn subshell_end(&mut self)
fn subshell_end(&mut self)
End subshell scope (restore state).
Source§fn redirect(&mut self, fd: u8, op: u8, target: &str)
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)
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)
fn with_redirects_end(&mut self)
End scoped redirect block — restore fd state.
Source§fn herestring(&mut self, content: &str)
fn herestring(&mut self, content: &str)
Herestring body for the next command’s stdin.
Source§fn exec(&mut self, args: Vec<String>) -> i32
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
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>
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 array_index(&mut self, name: &str, index: &Value) -> Value
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)
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)
fn pipeline_stage(&mut self)
Wire next pipeline stage (set up pipe between previous and next).
Source§fn pipeline_end(&mut self) -> i32
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)
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)
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
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§
impl Freeze for ZshrsHost
impl RefUnwindSafe for ZshrsHost
impl Send for ZshrsHost
impl Sync for ZshrsHost
impl Unpin for ZshrsHost
impl UnsafeUnpin for ZshrsHost
impl UnwindSafe for ZshrsHost
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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>
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 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>
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.
Source§impl<T> Pointable for T
impl<T> Pointable for T
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
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 Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
Convert this type into
T, using the provided data to resolve any offsets.