systemd-transient 0.2.0

Start transient systemd services using dbus, just like systemd-run.
Documentation
#![doc = include_str!("../README.md")]

mod dbus;
mod props;

mod error;
mod handle;
mod manager;
mod name;
mod reusable;
mod watch;

pub use error::SystemdTransientError as Error;
pub use handle::TransientUnitHandle;
pub use manager::{ListedUnit, SystemdTransientManager};
pub use name::escape_unit_name;
pub use props::*;
pub use reusable::ReusableTransientUnit;
/// The zbus version this crate uses, for `UnitProperty::Custom` values.
pub use zbus;

/// The state a unit ended in. These are systemd's only two inactive states.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum UnitExit {
  Inactive,
  Failed,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum UnitStatus {
  /// No run held: never started, stopped via `stop`, or released.
  Idle,
  Running,
  Exited(UnitExit),
  /// The signal stream ended before the unit exited; state unknown.
  Lost,
}

#[cfg(test)]
mod tests {
  /// Handles are moved into and shared between tasks.
  #[test]
  fn public_types_are_send_and_sync() {
    fn check<T: Send + Sync>() {}
    check::<crate::SystemdTransientManager>();
    check::<crate::TransientUnitHandle>();
    check::<crate::ReusableTransientUnit>();
    check::<crate::Error>();
  }
}