pub struct ScriptManager { /* private fields */ }Expand description
Manages multiple script subprocess instances for a single tab.
Each script is assigned a unique ScriptId and can be individually started,
stopped, and communicated with. Supports panel state tracking per script and
event broadcasting to all running scripts.
Implementations§
Source§impl ScriptManager
impl ScriptManager
Sourcepub fn new() -> ScriptManager
pub fn new() -> ScriptManager
Create a new empty ScriptManager.
Sourcepub fn start_script(&mut self, config: &ScriptConfig) -> Result<u64, String>
pub fn start_script(&mut self, config: &ScriptConfig) -> Result<u64, String>
Start a script subprocess from the given configuration.
If script_path ends with .py, the command is python3 with the script path
prepended to the args. Otherwise, script_path is used as the command directly.
Returns the assigned ScriptId on success.
§Errors
Returns an error string if the subprocess cannot be spawned.
Sourcepub fn is_running(&mut self, id: u64) -> bool
pub fn is_running(&mut self, id: u64) -> bool
Check if a script with the given ID is still running.
Returns false if the script ID is unknown or the process has exited.
Sourcepub fn send_event(&mut self, id: u64, event: &ScriptEvent) -> Result<(), String>
pub fn send_event(&mut self, id: u64, event: &ScriptEvent) -> Result<(), String>
Send a ScriptEvent to a specific script by ID.
§Errors
Returns an error if the script ID is unknown or the write fails.
Sourcepub fn broadcast_event(&mut self, event: &ScriptEvent)
pub fn broadcast_event(&mut self, event: &ScriptEvent)
Broadcast a ScriptEvent to all running scripts.
Errors on individual scripts are silently ignored; the event is sent on a best-effort basis to all processes.
Sourcepub fn read_commands(&self, id: u64) -> Vec<ScriptCommand>
pub fn read_commands(&self, id: u64) -> Vec<ScriptCommand>
Drain pending ScriptCommands from a specific script’s stdout buffer.
Returns an empty Vec if the script ID is unknown.
Sourcepub fn read_errors(&self, id: u64) -> Vec<String>
pub fn read_errors(&self, id: u64) -> Vec<String>
Drain pending error lines from a specific script’s stderr buffer.
Returns an empty Vec if the script ID is unknown.
Sourcepub fn stop_script(&mut self, id: u64)
pub fn stop_script(&mut self, id: u64)
Stop and remove a specific script by ID.
Also clears the associated panel state. Does nothing if the ID is unknown.
Sourcepub fn get_panel(&self, id: u64) -> Option<&(String, String)>
pub fn get_panel(&self, id: u64) -> Option<&(String, String)>
Get the panel state for a script.
Returns None if the script ID has no panel set.
Sourcepub fn set_panel(&mut self, id: u64, title: String, content: String)
pub fn set_panel(&mut self, id: u64, title: String, content: String)
Set the panel state (title, content) for a script.
Sourcepub fn clear_panel(&mut self, id: u64)
pub fn clear_panel(&mut self, id: u64)
Clear the panel state for a script.
Sourcepub fn script_ids(&self) -> Vec<u64>
pub fn script_ids(&self) -> Vec<u64>
Get the IDs of all currently managed scripts.
Trait Implementations§
Source§impl Default for ScriptManager
impl Default for ScriptManager
Source§fn default() -> ScriptManager
fn default() -> ScriptManager
Auto Trait Implementations§
impl Freeze for ScriptManager
impl !RefUnwindSafe for ScriptManager
impl Send for ScriptManager
impl Sync for ScriptManager
impl Unpin for ScriptManager
impl UnsafeUnpin for ScriptManager
impl !UnwindSafe for ScriptManager
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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>
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 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> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().