systemd_transient/
handle.rs1use std::time::Duration;
2
3use crate::{SystemdTransientManager, UnitExit, error::SystemdTransientError};
4
5pub struct TransientUnitHandle {
6 pub(crate) name: String,
7 pub(crate) stop_timeout: Duration,
8 pub(crate) manager: SystemdTransientManager,
9}
10
11impl TransientUnitHandle {
12 pub async fn stop(self) -> Result<(), SystemdTransientError> {
13 self.manager.stop(&self.name, self.stop_timeout).await?;
14 Ok(())
18 }
19
20 pub async fn wait_for_exit(&self) -> Result<UnitExit, SystemdTransientError> {
21 self.manager.wait_for_exit(&self.name).await
22 }
23}