Skip to main content

ConfigRelativePathResolveExt

Trait ConfigRelativePathResolveExt 

Source
pub trait ConfigRelativePathResolveExt {
    // Required methods
    fn resolve_path(&self, gctx: &GlobalContext) -> PathBuf;
    fn resolve_templated_path(
        &self,
        gctx: &GlobalContext,
        replacements: impl IntoIterator<Item = (impl AsRef<str>, impl AsRef<str>)>,
    ) -> Result<PathBuf, ResolveTemplateError>;
    fn resolve_program(&self, gctx: &GlobalContext) -> PathBuf;
}
Expand description

Resolves configuration-relative paths using the global context.

Required Methods§

Source

fn resolve_path(&self, gctx: &GlobalContext) -> PathBuf

Resolves this configuration-relative path to an absolute path.

This will always return an absolute path where it’s relative to the location for configuration for this value.

Source

fn resolve_templated_path( &self, gctx: &GlobalContext, replacements: impl IntoIterator<Item = (impl AsRef<str>, impl AsRef<str>)>, ) -> Result<PathBuf, ResolveTemplateError>

Same as Self::resolve_path but will make string replacements before resolving the path.

replacements should be an IntoIterator of tuples with the “from” and “to” for the string replacement.

Source

fn resolve_program(&self, gctx: &GlobalContext) -> PathBuf

Resolves this configuration-relative path to either an absolute path or something appropriate to execute from PATH.

Values which don’t look like a filesystem path (don’t contain / or \) will be returned as-is, and everything else will fall through to an absolute path.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§