pub struct ShellOwner { /* private fields */ }Expand description
Dedicated-thread owner for a TclShell.
Spawns one OS thread that builds a current-thread tokio runtime + LocalSet,
constructs the TclShell on that thread (preserving its !Send requirement),
and services ad-hoc eval() calls (from slash-command routing) via
Self::eval, which blocks the calling thread (parked, not spinning) until
the owner thread replies.
Dropping the ShellOwner drops job_tx, which ends the owner thread’s job
loop.
Implementations§
Source§impl ShellOwner
impl ShellOwner
Sourcepub fn spawn(subject: Subject, namespace: Arc<Namespace>) -> Self
pub fn spawn(subject: Subject, namespace: Arc<Namespace>) -> Self
Spawn the owner thread, constructing a TclShell from subject/namespace.
Sourcepub fn eval(&self, script: &str) -> Result<String, String>
pub fn eval(&self, script: &str) -> Result<String, String>
Evaluate a Tcl script on the owner thread and block (parked, not spun) until the result is ready.
Safe to call from any thread context, including from inside an active
tokio runtime — uses std::sync::mpsc, not tokio::sync::oneshot, for
the reply leg specifically so it never hits tokio’s “cannot block the
current thread from within a runtime” panic (see module docs).
Auto Trait Implementations§
impl Freeze for ShellOwner
impl !RefUnwindSafe for ShellOwner
impl Send for ShellOwner
impl Sync for ShellOwner
impl Unpin for ShellOwner
impl UnsafeUnpin for ShellOwner
impl !UnwindSafe for ShellOwner
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