pub struct SystemdTransientManager { /* private fields */ }Implementations§
Source§impl SystemdTransientManager
impl SystemdTransientManager
pub async fn system() -> Result<Self, SystemdTransientError>
pub async fn session() -> Result<Self, SystemdTransientError>
Sourcepub fn new_reusable(
&self,
name: impl Into<String>,
props: impl IntoIterator<Item = UnitProperty>,
) -> ReusableTransientUnit
pub fn new_reusable( &self, name: impl Into<String>, props: impl IntoIterator<Item = UnitProperty>, ) -> ReusableTransientUnit
See start for name and props.
Sourcepub async fn start(
&self,
name: &str,
props: impl IntoIterator<Item = UnitProperty>,
) -> Result<TransientUnitHandle, SystemdTransientError>
pub async fn start( &self, name: &str, props: impl IntoIterator<Item = UnitProperty>, ) -> Result<TransientUnitHandle, SystemdTransientError>
Starts name as a transient unit and returns once its start job
finished.
name keeps a unit type suffix (.slice, .socket, .scope, …);
any other name gets .service appended. A slice that other units name
in Slice= before it is started is created implicitly and is not
transient, so start a transient slice before the units in it.
Sourcepub async fn adopt(
&self,
name: &str,
) -> Result<Option<TransientUnitHandle>, SystemdTransientError>
pub async fn adopt( &self, name: &str, ) -> Result<Option<TransientUnitHandle>, SystemdTransientError>
Takes over the transient unit name, for example one that an earlier
process started and did not stop. The handle holds its own reference
and works like one from start; the unit keeps the
properties it was started with. name is completed as for start.
Running and exited units both qualify, as long as systemd still has
them loaded: a failed unit stays loaded until it is reset, an inactive
one only while something references it. Returns None if no unit of
that name is loaded, and UnitNotTransient for a unit from a unit file.
Sourcepub async fn list_units(
&self,
patterns: &[&str],
) -> Result<Vec<ListedUnit>, SystemdTransientError>
pub async fn list_units( &self, patterns: &[&str], ) -> Result<Vec<ListedUnit>, SystemdTransientError>
Loaded units whose names match one of patterns, shell globs as for
systemctl list-units. No patterns match every loaded unit.