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§
- Files
- The iterator of files returned by
SearchDirectoriesForProject::find_files
,SearchDirectoriesForFileName::find_files
andSearchDirectoriesForProjectAndFileName::find_files
. - Invalid
Path Error - Error returned when a path does not start with
Component::RootDir
or when it containsComponent::ParentDir
. - Search
Directories - A list of search directories that the config files will be searched under.
- Search
Directories ForFile Name - A list of search directories that the config files will be searched under, scoped to a particular config file name.
- Search
Directories ForProject - A list of search directories that the config files will be searched under, scoped to a particular project.
- Search
Directories ForProject AndFile Name - A list of search directories that the config files will be searched under, scoped to a particular project and config file name.