Make environment in EnvCommand mutable

This commit is contained in:
Leonard Steppy 2025-02-05 00:02:54 +01:00
parent 8315549838
commit 4095ee32f6

View File

@ -11,7 +11,7 @@ use std::process::Command;
#[derive(Debug)]
pub struct EnvCommand<'a, E> {
command: ShellCommand,
environment: &'a E,
environment: &'a mut E,
}
#[derive(Debug, Clone)]
@ -34,7 +34,7 @@ pub enum ShellCommand {
}
impl ShellCommand {
pub fn at<E>(self, environment: &E) -> EnvCommand<E> {
pub fn at<E>(self, environment: &mut E) -> EnvCommand<E> {
EnvCommand {
command: self,
environment,
@ -93,7 +93,7 @@ fn command_to_string(command: &Command) -> String {
.join(" ")
}
fn build_command_from_shell_command(shell_command: &ShellCommand) -> Command {
fn build_command_from_shell_command(_shell_command: &ShellCommand) -> Command {
todo!()
}
@ -123,6 +123,8 @@ pub trait ShellInterface {
}
}
//TODO implement shell interface for env command
pub trait MaybeCast<T> {
fn maybe_cast(&self) -> Option<&T>;
}