pub enum TaskMonitorControlCommand {
TerminateAllTasks,
TerminateTask {
task_name: String,
},
SendStdin {
task_name: String,
input: String,
},
}
Expand description
Control message for TaskMonitor
execution.
These control messages allow runtime interaction with task execution, providing the ability to stop tasks, send input, or terminate specific tasks.
§Examples
§Terminating All Tasks
use tcrm_monitor::monitor::event::TaskMonitorControlCommand;
let control = TaskMonitorControlCommand::TerminateAllTasks;
§Sending Stdin to a Task
use tcrm_monitor::monitor::event::TaskMonitorControlCommand;
let control = TaskMonitorControlCommand::SendStdin {
task_name: "interactive_task".to_string(),
input: "y\n".to_string()
};
§Terminating a Specific Task
use tcrm_monitor::monitor::event::TaskMonitorControlCommand;
let control = TaskMonitorControlCommand::TerminateTask {
task_name: "runaway_task".to_string()
};
Variants§
TerminateAllTasks
Stop all tasks gracefully and terminate execution.
This will attempt to stop all running tasks in an orderly fashion, waiting for them to complete their current operations before terminating.
TerminateTask
Terminate a specific task by name.
This forcefully terminates the specified task without waiting for it to complete naturally.
§Fields
task_name
- Name of the task to terminate
SendStdin
Send stdin input to a specific task.
Only works if the target task was configured with enable_stdin(true)
.
The input will be delivered to the task’s stdin stream.
§Fields
task_name
- Name of the target taskinput
- String input to send to the task’s stdin
§Examples
use tcrm_monitor::monitor::event::TaskMonitorControlCommand;
// Send "yes" followed by newline to a task
let control = TaskMonitorControlCommand::SendStdin {
task_name: "confirmation_task".to_string(),
input: "yes\n".to_string()
};
Trait Implementations§
Source§impl Clone for TaskMonitorControlCommand
impl Clone for TaskMonitorControlCommand
Source§fn clone(&self) -> TaskMonitorControlCommand
fn clone(&self) -> TaskMonitorControlCommand
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for TaskMonitorControlCommand
impl RefUnwindSafe for TaskMonitorControlCommand
impl Send for TaskMonitorControlCommand
impl Sync for TaskMonitorControlCommand
impl Unpin for TaskMonitorControlCommand
impl UnwindSafe for TaskMonitorControlCommand
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
Mutably borrows from an owned value. Read more