use crate::command_runner::CommandRunner; use crate::symbols::Symbol; use std::borrow::Borrow; use std::error::Error; use std::marker::PhantomData; #[derive(Debug)] pub struct ReloadService<_C, C, S> { service: S, command_runner: C, phantom: PhantomData<_C>, } impl<_C, C, S> ReloadService<_C, C, S> { pub fn new(command_runner: C, service: S) -> Self { Self { service, command_runner, phantom: PhantomData::default(), } } } impl, _C: CommandRunner, C: Borrow<_C>> Symbol for ReloadService<_C, C, S> { fn target_reached(&self) -> Result> { Ok(true) } fn execute(&self) -> Result<(), Box> { self.command_runner.borrow().run_successfully( "systemctl", args!["reload-or-restart", self.service.as_ref()], ) } }