pub struct Resolver { /* private fields */ }Expand description
Resolver for ${...} expressions.
Build with Resolver::new for production use; the Resolver::for_platform
and with_* builders are for tests and explicit overrides.
Implementations§
Source§impl Resolver
impl Resolver
Sourcepub fn for_platform(platform: Platform) -> Self
pub fn for_platform(platform: Platform) -> Self
Construct with an explicit platform. Useful in tests.
Sourcepub fn with_env(self, env: HashMap<String, String>) -> Self
pub fn with_env(self, env: HashMap<String, String>) -> Self
Replace the env snapshot used for ${env:...} lookups. Useful in
tests to avoid leaking the host’s environment in.
Sourcepub fn with_overrides(self, overrides: BTreeMap<String, String>) -> Self
pub fn with_overrides(self, overrides: BTreeMap<String, String>) -> Self
Layer [paths]-style overrides on top of the built-in defaults.
Override values may themselves contain ${...} expressions.
Sourcepub fn resolve(&self, input: &str) -> Result<String, ResolveError>
pub fn resolve(&self, input: &str) -> Result<String, ResolveError>
Resolve a string containing zero or more ${...} expressions.
Sourcepub fn resolve_var(&self, name: &str) -> Result<String, ResolveError>
pub fn resolve_var(&self, name: &str) -> Result<String, ResolveError>
Resolve a single bare variable name (no ${} syntax) to its value.
${NAME} in a template eventually calls this.
Sourcepub fn known_vars(&self) -> Vec<String>
pub fn known_vars(&self) -> Vec<String>
Iterate over every variable name the resolver knows how to expand —
built-ins available on the current platform, plus all overrides.
Useful for krypt paths and krypt doctor.