Expand description

The systemd-directories crate is a tiny library to retrieve systemd directories following systemd.exec(5).

The library can be used in two ways:

  • As standalone functions to retrieve the directories.
  • As a struct to snapshot the environment at the time of creating SystemdDirs

§Examples

§Standalone functions

use systemd_directories;
let runtime_dir = systemd_directories::runtime_dir();

§SystemdDirs Struct

use systemd_directories::SystemdDirs;
let dirs = SystemdDirs::new();
let runtime_dir = dirs.runtime_dir();

Structs§

  • A struct to snapshot the environment at the time of creation.

Functions§

  • Returns the first cache directory as defined by CacheDirectory in the unit file.
  • Returns all cache directories as defined by CacheDirectory in the unit file.
  • Returns the first configuration directory as defined by ConfigurationDirectory in the unit file.
  • Returns all configuration directories as defined by ConfigurationDirectory in the unit file.
  • Returns the first logs directory as defined by LogsDirectory in the unit file.
  • Returns all logs directories as defined by LogsDirectory in the unit file.
  • Returns the first runtime directory as defined by RuntimeDirectory in the unit file.
  • Returns all runtime directories as defined by RuntimeDirectory in the unit file.
  • Returns the first state directory as defined by StateDirectory in the unit file.
  • Returns all state directories as defined by StateDirectory in the unit file.