WorkspacePaths

Trait WorkspacePaths 

Source
pub trait WorkspacePaths: Send + Sync {
    // Required methods
    fn workspace_root(&self) -> &Path;
    fn config_dir(&self) -> PathBuf;

    // Provided methods
    fn cache_dir(&self) -> Option<PathBuf> { ... }
    fn telemetry_dir(&self) -> Option<PathBuf> { ... }
    fn scope_for_path(&self, path: &Path) -> PathScope { ... }
}
Expand description

Provides the root directories an application uses to store data.

Required Methods§

Source

fn workspace_root(&self) -> &Path

Absolute path to the application’s workspace root.

Source

fn config_dir(&self) -> PathBuf

Returns the directory where configuration files should be stored.

Provided Methods§

Source

fn cache_dir(&self) -> Option<PathBuf>

Returns an optional cache directory for transient data.

Source

fn telemetry_dir(&self) -> Option<PathBuf>

Returns an optional directory for telemetry or log artifacts.

Source

fn scope_for_path(&self, path: &Path) -> PathScope

Determine the PathScope for a given path based on workspace directories.

Returns the most specific scope matching the path:

  • Workspace if under workspace_root()
  • Config if under config_dir()
  • Cache if under cache_dir()
  • Telemetry if under telemetry_dir()
  • Falls back to Cache if no match

Implementors§