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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Resolver
impl RefUnwindSafe for Resolver
impl Send for Resolver
impl Sync for Resolver
impl Unpin for Resolver
impl UnsafeUnpin for Resolver
impl UnwindSafe for Resolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more