Make Job store boxed process list instead of Vec

This commit is contained in:
Peter Ammon
2025-06-14 12:04:39 -07:00
parent d92bb57418
commit d67fdd1f02
2 changed files with 5 additions and 7 deletions

View File

@@ -1835,7 +1835,7 @@ fn populate_job_from_job_node(
if result == EndExecutionReason::ok {
// Link up the processes.
assert!(!processes.is_empty());
*j.processes_mut() = processes;
*j.processes_mut() = processes.into_boxed_slice();
}
result
}

View File

@@ -791,7 +791,7 @@ pub struct Job {
command_str: WString,
/// All the processes in this job.
pub processes: Vec<Process>,
pub processes: Box<[Process]>,
// The group containing this job.
// This is never cleared.
@@ -824,15 +824,13 @@ pub fn command(&self) -> &wstr {
&self.command_str
}
/// Borrow the job's process list. Only read-only or interior mutability actions may be
/// performed on the processes in the list.
/// Borrow the job's process list.
pub fn processes(&self) -> &[Process] {
&self.processes
}
/// Get mutable access to the job's process list.
/// Only available with a mutable reference `&mut Job`.
pub fn processes_mut(&mut self) -> &mut Vec<Process> {
/// Get the mutable list of processes.
pub fn processes_mut(&mut self) -> &mut Box<[Process]> {
&mut self.processes
}