pub struct TemplateVars { /* private fields */ }Implementations§
Source§impl TemplateVars
impl TemplateVars
pub fn new() -> Self
pub fn set(&mut self, key: &str, value: &str)
Sourcepub fn unset(&mut self, key: &str) -> bool
pub fn unset(&mut self, key: &str) -> bool
Remove a regular template variable. Returns true if the key was
present. Use when a value is logically undefined for downstream
renders — distinct from set(key, "") which keeps the key with an
empty string. Strict-mode template rendering can distinguish defined-
empty from undefined; the latter is the correct shape for per-config
vars (e.g. BaseImage) that should not bleed across iterations.
Sourcepub fn unset_structured(&mut self, key: &str) -> bool
pub fn unset_structured(&mut self, key: &str) -> bool
Remove a structured (non-string) template variable. Mirrors unset
for the structured map. Returns true if the key was present.
pub fn get(&self, key: &str) -> Option<&String>
pub fn set_env(&mut self, key: &str, value: &str)
Sourcepub fn set_config_env(&mut self, key: &str, value: &str)
pub fn set_config_env(&mut self, key: &str, value: &str)
Set an env var that was explicitly configured by the user. Also adds it to the general env map for template rendering.
pub fn set_custom_var(&mut self, key: &str, value: &str)
Sourcepub fn set_output(&mut self, key: &str, value: &str)
pub fn set_output(&mut self, key: &str, value: &str)
Set a pipeline output value accessible as {{ .Outputs.key }}.
Infrastructure: no stage populates Outputs yet. Concrete key mappings will be added as individual stages are enhanced (e.g. build -> build_id).
Sourcepub fn get_output(&self, key: &str) -> Option<&String>
pub fn get_output(&self, key: &str) -> Option<&String>
Get a pipeline output value by key.
Sourcepub fn set_structured(&mut self, key: &str, value: Value)
pub fn set_structured(&mut self, key: &str, value: Value)
Set a structured (non-string) value accessible directly in Tera context.
Used for complex types like arrays of maps (Artifacts) or nested maps
(Metadata) that cannot be represented as flat key=value strings.
Sourcepub fn all(&self) -> &HashMap<String, String>
pub fn all(&self) -> &HashMap<String, String>
Return all template variables (excluding env and custom vars).
Sourcepub fn all_env(&self) -> &HashMap<String, String>
pub fn all_env(&self) -> &HashMap<String, String>
Return all environment variables (process + config). Used for template rendering ({{ .Env.* }}).
Sourcepub fn all_config_env(&self) -> &HashMap<String, String>
pub fn all_config_env(&self) -> &HashMap<String, String>
Return only explicitly configured env vars (config env:, .env files).
Safe to serialize into split contexts and inject into subprocesses.
Process-inherited vars (HOME, PATH, etc.) are excluded — subprocesses
inherit them naturally, and serializing them across platforms is poison
(macOS HOME=/Users/runner breaks Linux docker builds).
Sourcepub fn get_structured(&self, key: &str) -> Option<&Value>
pub fn get_structured(&self, key: &str) -> Option<&Value>
Get a structured (non-string) template variable by key.
Returns None if the key does not exist in the structured map.
Sourcepub fn all_structured(&self) -> &HashMap<String, Value>
pub fn all_structured(&self) -> &HashMap<String, Value>
Return all structured template variables.
Trait Implementations§
Source§impl Clone for TemplateVars
impl Clone for TemplateVars
Source§fn clone(&self) -> TemplateVars
fn clone(&self) -> TemplateVars
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more