Skip to main content

ConfigDefaultsProvider

Trait ConfigDefaultsProvider 

Source
pub trait ConfigDefaultsProvider: Send + Sync {
    // Required methods
    fn workspace_paths_for(
        &self,
        workspace_root: &Path,
    ) -> Box<dyn WorkspacePaths>;
    fn home_config_paths(&self, config_file_name: &str) -> Vec<PathBuf>;
    fn syntax_theme(&self) -> String;
    fn syntax_languages(&self) -> Vec<String>;

    // Provided methods
    fn config_file_name(&self) -> &str { ... }
    fn canonical_user_config_dir(&self) -> Result<Option<PathBuf>> { ... }
    fn canonical_user_config_path(
        &self,
        config_file_name: &str,
    ) -> Result<Option<PathBuf>> { ... }
    fn system_config_paths(
        &self,
        _config_file_name: &str,
    ) -> Result<Vec<PathBuf>> { ... }
}
Expand description

Provides access to filesystem and syntax defaults used by the configuration loader.

Required Methods§

Source

fn workspace_paths_for(&self, workspace_root: &Path) -> Box<dyn WorkspacePaths>

Creates a WorkspacePaths implementation for the provided workspace root.

Source

fn home_config_paths(&self, config_file_name: &str) -> Vec<PathBuf>

Returns the fallback configuration locations searched outside the workspace.

Source

fn syntax_theme(&self) -> String

Returns the default syntax highlighting theme identifier.

Source

fn syntax_languages(&self) -> Vec<String>

Returns the default list of syntax highlighting languages.

Provided Methods§

Source

fn config_file_name(&self) -> &str

Returns the primary configuration file name expected in a workspace.

Source

fn canonical_user_config_dir(&self) -> Result<Option<PathBuf>>

Returns the canonical user configuration directory.

The default preserves custom providers by deriving it from their highest-precedence home configuration path.

Source

fn canonical_user_config_path( &self, config_file_name: &str, ) -> Result<Option<PathBuf>>

Returns the canonical user configuration file for config_file_name.

Existing providers remain compatible: their last home path has always represented the highest-precedence user layer.

Source

fn system_config_paths(&self, _config_file_name: &str) -> Result<Vec<PathBuf>>

Returns system configuration files from lowest to highest precedence.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§