pub struct SearchDirectories<'a> { /* private fields */ }Expand description
A list of search directories that the config files will be searched under.
Implementations§
Source§impl<'a> SearchDirectories<'a>
impl<'a> SearchDirectories<'a>
Sourcepub fn classic_system() -> Self
pub fn classic_system() -> Self
Start with the default search directory roots for a system application on a classic Linux distribution.
The OS vendor ships configuration in /usr/lib, ephemeral configuration is defined in /var/run,
and the sysadmin places overrides in /etc.
Sourcepub fn modern_system() -> Self
pub fn modern_system() -> Self
Start with the default search directory roots for a system application on a modern Linux distribution.
The OS vendor ships configuration in /usr/etc, ephemeral configuration is defined in /run,
and the sysadmin places overrides in /etc.
Sourcepub fn with_user_directory(self) -> Self
pub fn with_user_directory(self) -> Self
Append the directory for local user config overrides, $XDG_CONFIG_HOME.
If the dirs crate feature is enabled, then dirs::config_dir() is used for the implementation of $XDG_CONFIG_HOME.
else a custom implementation is used.
Sourcepub fn chroot(self, root: &Path) -> Result<Self, InvalidPathError>
pub fn chroot(self, root: &Path) -> Result<Self, InvalidPathError>
Prepend the specified path to all search directories.
§Errors
Returns Err(InvalidPathError) if root does not start with a Component::RootDir or if it contains Component::ParentDir.
Sourcepub fn push(&mut self, path: Cow<'a, Path>) -> Result<(), InvalidPathError>
pub fn push(&mut self, path: Cow<'a, Path>) -> Result<(), InvalidPathError>
Appends a search directory to the end of the list. Files found in this directory will override files found in earlier directories.
§Errors
Returns Err(InvalidPathError) if path does not start with a Component::RootDir or if it contains Component::ParentDir.
Sourcepub fn with_project<TProject>(
self,
project: TProject,
) -> SearchDirectoriesForProject<'a, TProject>
pub fn with_project<TProject>( self, project: TProject, ) -> SearchDirectoriesForProject<'a, TProject>
Search for configuration files for the given project name.
The project name is usually the name of your application.
Sourcepub fn with_file_name<TFileName>(
self,
file_name: TFileName,
) -> SearchDirectoriesForFileName<'a, TFileName>
pub fn with_file_name<TFileName>( self, file_name: TFileName, ) -> SearchDirectoriesForFileName<'a, TFileName>
Search for configuration files with the given config file name.
Trait Implementations§
Source§impl<'a> Clone for SearchDirectories<'a>
impl<'a> Clone for SearchDirectories<'a>
Source§fn clone(&self) -> SearchDirectories<'a>
fn clone(&self) -> SearchDirectories<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more