Skip to main content

systemd_transient/
lib.rs

1#![doc = include_str!("../README.md")]
2
3mod dbus;
4mod props;
5
6mod error;
7mod handle;
8mod manager;
9mod name;
10mod reusable;
11mod watch;
12
13pub use error::SystemdTransientError as Error;
14pub use handle::TransientUnitHandle;
15pub use manager::{ListedUnit, SystemdTransientManager};
16pub use name::escape_unit_name;
17pub use props::*;
18pub use reusable::ReusableTransientUnit;
19/// The zbus version this crate uses, for `UnitProperty::Custom` values.
20pub use zbus;
21
22/// The state a unit ended in. These are systemd's only two inactive states.
23#[derive(Debug, Clone, Copy, PartialEq, Eq)]
24pub enum UnitExit {
25  Inactive,
26  Failed,
27}
28
29#[derive(Debug, Clone, Copy, PartialEq, Eq)]
30#[non_exhaustive]
31pub enum UnitStatus {
32  /// No run held: never started, stopped via `stop`, or released.
33  Idle,
34  Running,
35  Exited(UnitExit),
36  /// The signal stream ended before the unit exited; state unknown.
37  Lost,
38}
39
40#[cfg(test)]
41mod tests {
42  /// Handles are moved into and shared between tasks.
43  #[test]
44  fn public_types_are_send_and_sync() {
45    fn check<T: Send + Sync>() {}
46    check::<crate::SystemdTransientManager>();
47    check::<crate::TransientUnitHandle>();
48    check::<crate::ReusableTransientUnit>();
49    check::<crate::Error>();
50  }
51}