Skip to main content

PathResolver

Trait PathResolver 

Source
pub trait PathResolver {
    // Required method
    fn resolve(&self, path: &str) -> Option<String>;

    // Provided method
    fn read_dir(&self, _dir: &str) -> Vec<String> { ... }
}
Expand description

Resolves symlinks in normalised, slash-separated absolute paths.

Required Methods§

Source

fn resolve(&self, path: &str) -> Option<String>

The path path really refers to, or None when it is the same path or cannot be resolved. Paths that do not exist yet resolve through their deepest existing ancestor, so a new file written into a symlinked directory still resolves to where it would land.

Provided Methods§

Source

fn read_dir(&self, _dir: &str) -> Vec<String>

The names in the directory dir (a normalised absolute path), without . and ..; empty when it is not a directory or cannot be read. Used only to expand an unquoted glob operand as the shell would (crate::expand). Without a filesystem nothing is listed, and the operand stays literal, as a glob that matches nothing does in bash.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§