use std::time::Duration;
use crate::{SystemdTransientManager, UnitExit, error::SystemdTransientError};
pub struct TransientUnitHandle {
pub(crate) name: String,
pub(crate) stop_timeout: Duration,
pub(crate) manager: SystemdTransientManager,
}
impl TransientUnitHandle {
pub async fn stop(self) -> Result<(), SystemdTransientError> {
self.manager.stop(&self.name, self.stop_timeout).await?;
Ok(())
}
pub async fn wait_for_exit(&self) -> Result<UnitExit, SystemdTransientError> {
self.manager.wait_for_exit(&self.name).await
}
}