pub struct VariableContext {
pub build_args: HashMap<String, String>,
pub arg_defaults: HashMap<String, String>,
pub env_vars: HashMap<String, String>,
}Expand description
Builder for tracking variable state during Dockerfile processing
Fields§
§build_args: HashMap<String, String>Build-time ARG values (from –build-arg)
arg_defaults: HashMap<String, String>ARG default values from Dockerfile
env_vars: HashMap<String, String>ENV values accumulated during processing
Implementations§
Source§impl VariableContext
impl VariableContext
Sourcepub fn with_build_args(build_args: HashMap<String, String>) -> Self
pub fn with_build_args(build_args: HashMap<String, String>) -> Self
Create with build-time arguments
Sourcepub fn add_arg(&mut self, name: impl Into<String>, default: Option<String>)
pub fn add_arg(&mut self, name: impl Into<String>, default: Option<String>)
Register an ARG with optional default
Sourcepub fn set_env(&mut self, name: impl Into<String>, value: impl Into<String>)
pub fn set_env(&mut self, name: impl Into<String>, value: impl Into<String>)
Set an ENV variable
Sourcepub fn effective_args(&self) -> HashMap<String, String>
pub fn effective_args(&self) -> HashMap<String, String>
Get the effective ARG values (build-time overrides defaults)
Sourcepub fn expand(&self, input: &str) -> String
pub fn expand(&self, input: &str) -> String
Expand variables in a string using the current context
Sourcepub fn expand_list(&self, inputs: &[String]) -> Vec<String>
pub fn expand_list(&self, inputs: &[String]) -> Vec<String>
Expand variables in a list of strings
Trait Implementations§
Source§impl Clone for VariableContext
impl Clone for VariableContext
Source§fn clone(&self) -> VariableContext
fn clone(&self) -> VariableContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VariableContext
impl Debug for VariableContext
Source§impl Default for VariableContext
impl Default for VariableContext
Source§fn default() -> VariableContext
fn default() -> VariableContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for VariableContext
impl RefUnwindSafe for VariableContext
impl Send for VariableContext
impl Sync for VariableContext
impl Unpin for VariableContext
impl UnsafeUnpin for VariableContext
impl UnwindSafe for VariableContext
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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