Crate uapi_config

source ·
Expand description

Rust implementation of the UAPI Configuration Files Specification.

The tl;dr of the spec is:

  • The search acts on a list of search directories. The directories are considered in the order that they appear in the list.

  • In each search directory, the algorithm looks for a config file with the requested filename.

  • In each search directory, a directory with a name that is the requested name followed by “.d” is considered to be a dropin directory. Any files in such dropin directories are also considered, in lexicographic order of filename.

  • If a file with the requested name is present in more than one search directory, the file in the earlier search directory is ignored. If a dropin file with the same name is present in more than one dropin directory, the file in the earlier dropin directory is ignored.

  • The config file, if found, is yielded, followed by any dropins that were found. Settings in files yielded later override settings in files yielded earlier.

  • If no filename is requested, then the algorithm only looks for a directory with a name that is the project name followed by “.d” under all search directories, and treats those directories as dropin directories.

let files /* : impl Iterator<Item = (PathBuf, File)> */ =
    uapi_config::SearchDirectories::modern_system()
    .with_project("foobar")
    .find_files(".conf")
    .unwrap();

Structs§