pub struct DirectoryConfig { /* private fields */ }Expand description
Configuration for loading known values from directories.
This struct specifies which directories to search for JSON registry files. Directories are processed in order, with values from later directories overriding values from earlier directories when codepoints collide.
§Examples
use known_values::DirectoryConfig;
// Use only the default directory (~/.known-values/)
let config = DirectoryConfig::default();
// Use custom paths
let config = DirectoryConfig::with_paths(vec![
"/etc/known-values".into(),
"/usr/share/known-values".into(),
]);
// Use custom paths with default appended
let config = DirectoryConfig::with_paths_and_default(vec![
"/etc/known-values".into(),
]);Implementations§
Source§impl DirectoryConfig
impl DirectoryConfig
Sourcepub fn default_only() -> Self
pub fn default_only() -> Self
Creates configuration with only the default directory
(~/.known-values/).
Sourcepub fn with_paths(paths: Vec<PathBuf>) -> Self
pub fn with_paths(paths: Vec<PathBuf>) -> Self
Creates configuration with custom paths (processed in order).
Later paths in the list take precedence over earlier paths when values have the same codepoint.
Sourcepub fn with_paths_and_default(paths: Vec<PathBuf>) -> Self
pub fn with_paths_and_default(paths: Vec<PathBuf>) -> Self
Creates configuration with custom paths followed by the default directory.
The default directory (~/.known-values/) is appended to the list,
so its values will override values from the custom paths.
Sourcepub fn default_directory() -> PathBuf
pub fn default_directory() -> PathBuf
Returns the default directory: ~/.known-values/
Falls back to ./.known-values/ if the home directory cannot be
determined.
Trait Implementations§
Source§impl Clone for DirectoryConfig
impl Clone for DirectoryConfig
Source§fn clone(&self) -> DirectoryConfig
fn clone(&self) -> DirectoryConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more