Skip to main content

EnvSource

Trait EnvSource 

Source
pub trait EnvSource {
    // Required method
    fn var_os(&self, key: &str) -> Option<OsString>;

    // Provided methods
    fn path_exists(&self, path: &Path) -> bool { ... }
    fn temp_dir(&self) -> PathBuf { ... }
    fn current_dir(&self) -> Result<PathBuf> { ... }
}
Expand description

Environment and filesystem inputs used by a directory resolver.

Override the filesystem methods as well as var_os for fully isolated tests. No resolver mutates the process environment.

Required Methods§

Source

fn var_os(&self, key: &str) -> Option<OsString>

Read a variable without losing non-Unicode path characters.

Provided Methods§

Source

fn path_exists(&self, path: &Path) -> bool

Whether path exists. The resolver uses it to tell an existing installation’s data directory from one that has never been created.

Source

fn temp_dir(&self) -> PathBuf

The system temporary directory. It holds the last fallback location of the daemon’s connection file (see Dirs::connection_file_candidates).

Source

fn current_dir(&self) -> Result<PathBuf>

The process’s current directory, which a relative path given explicitly by the user (for example a --subc ./conn.json argument) is joined to.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§