pub struct TclShell { /* private fields */ }Expand description
A Tcl shell backed by the hyprstream VFS namespace.
Contains a molt Interp which is !Send (uses Rc internally).
Must be constructed and used on the same thread — use spawn_blocking
to run on a dedicated thread, passing only Send arguments (subject, vfs_tx).
Implementations§
Source§impl TclShell
impl TclShell
Sourcepub fn new(subject: Subject, namespace: Arc<Namespace>) -> Self
pub fn new(subject: Subject, namespace: Arc<Namespace>) -> Self
Create a new Tcl shell bound to the given caller identity and VFS namespace.
Builtins .await VFS operations directly on the namespace — no proxy channel.
TclShell is !Send due to molt’s Rc-based Value.
Must be used within a LocalSet or single-threaded executor.
Dangerous commands are removed and the recursion limit is lowered. All host I/O goes through the VFS — this is a guest interpreter.
Sourcepub async fn eval(&mut self, script: &str) -> Result<String, String>
pub async fn eval(&mut self, script: &str) -> Result<String, String>
Evaluate a Tcl script. Returns Ok(output) or Err(error message).
On “invalid command name” errors, tries /bin/{name} resolution
(Plan9 PATH model) before returning the error.
Sourcepub fn has_command(&self, name: &str) -> bool
pub fn has_command(&self, name: &str) -> bool
Check if a command name is registered in the interpreter.
Sourcepub fn set_env(&mut self, key: &str, value: &str) -> Result<(), String>
pub fn set_env(&mut self, key: &str, value: &str) -> Result<(), String>
Set an env array variable safely, bypassing the Tcl evaluator.
Uses Interp::set_element to avoid Tcl injection from values
containing unbalanced braces or bracket expressions.
Sourcepub fn set_instruction_limit(&mut self, limit: usize)
pub fn set_instruction_limit(&mut self, limit: usize)
Override the instruction limit (default: 100,000). Set to 0 for unlimited (not recommended for untrusted input).
Sourcepub async fn process_command(&mut self, cmd: TclCommand)
pub async fn process_command(&mut self, cmd: TclCommand)
Process one command from the mount channel.
Called from the owner thread’s event loop (e.g., ChatApp::tick()).
Each command carries a oneshot response channel; the caller blocks
until we send the reply.
Auto Trait Implementations§
impl Freeze for TclShell
impl !RefUnwindSafe for TclShell
impl !Send for TclShell
impl !Sync for TclShell
impl Unpin for TclShell
impl UnsafeUnpin for TclShell
impl !UnwindSafe for TclShell
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more