pub struct DirectoryConfig { /* private fields */ }Expand description
Known Values Extension 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 new() -> DirectoryConfig
pub fn new() -> DirectoryConfig
Creates a new empty configuration with no search paths.
Sourcepub fn default_only() -> DirectoryConfig
pub fn default_only() -> DirectoryConfig
Creates configuration with only the default directory
(~/.known-values/).
Sourcepub fn with_paths(paths: Vec<PathBuf>) -> DirectoryConfig
pub fn with_paths(paths: Vec<PathBuf>) -> DirectoryConfig
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>) -> DirectoryConfig
pub fn with_paths_and_default(paths: Vec<PathBuf>) -> DirectoryConfig
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 moreSource§impl Debug for DirectoryConfig
impl Debug for DirectoryConfig
Source§impl Default for DirectoryConfig
impl Default for DirectoryConfig
Source§fn default() -> DirectoryConfig
fn default() -> DirectoryConfig
Auto Trait Implementations§
impl Freeze for DirectoryConfig
impl RefUnwindSafe for DirectoryConfig
impl Send for DirectoryConfig
impl Sync for DirectoryConfig
impl Unpin for DirectoryConfig
impl UnwindSafe for DirectoryConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more