pub struct Values(pub Value);Expand description
Values container with deep merge capability
Tuple Fields§
§0: ValueImplementations§
Source§impl Values
impl Values
Sourcepub fn merge(&mut self, overlay: &Values)
pub fn merge(&mut self, overlay: &Values)
Deep merge another Values into this one
Rules:
- Scalars: overlay replaces base
- Objects: recursive merge
- Arrays: overlay replaces base (not appended)
Sourcepub fn set(&mut self, path: &str, value: JsonValue) -> Result<()>
pub fn set(&mut self, path: &str, value: JsonValue) -> Result<()>
Set a value by dotted path (e.g., “image.tag”)
Sourcepub fn into_inner(self) -> JsonValue
pub fn into_inner(self) -> JsonValue
Convert to JSON value
Sourcepub fn with_schema_defaults(schema_defaults: Values, base: Values) -> Self
pub fn with_schema_defaults(schema_defaults: Values, base: Values) -> Self
Merge with schema defaults applied first
The merge order is: schema defaults (lowest priority) -> base values (higher priority) This ensures that schema defaults are only used when values are not explicitly set.
Sourcepub fn scope_for_subchart(&self, subchart_name: &str) -> Values
pub fn scope_for_subchart(&self, subchart_name: &str) -> Values
Scope values for a subchart
When rendering a subchart, it should only see:
- Values under
<subchart_name>.*in the parent, as its root values - Global values under
global.*preserved as-is
The subchart’s own values.yaml defaults are merged separately before this.
§Example
Parent values:
global:
imageRegistry: docker.io
redis:
enabled: true
replicas: 3
postgresql:
enabled: falseCalling scope_for_subchart("redis") produces:
global:
imageRegistry: docker.io
enabled: true
replicas: 3Sourcepub fn for_subchart(
subchart_defaults: Values,
parent_values: &Values,
subchart_name: &str,
) -> Values
pub fn for_subchart( subchart_defaults: Values, parent_values: &Values, subchart_name: &str, ) -> Values
Merge subchart defaults with scoped parent values
This is the complete subchart value resolution:
- Start with subchart’s own
values.yamldefaults - Merge in the scoped values from parent
§Arguments
subchart_defaults- Values from the subchart’svalues.yamlparent_values- Parent’s merged valuessubchart_name- Name of the subchart (for scoping)
Sourcepub fn export_to_parent(&self, subchart_name: &str) -> Values
pub fn export_to_parent(&self, subchart_name: &str) -> Values
Export subchart values back to parent namespace
This is the inverse of scope_for_subchart - takes subchart-scoped values
and wraps them under the subchart’s namespace for parent access.
§Example
Subchart values:
global:
imageRegistry: docker.io
enabled: true
replicas: 3Calling export_to_parent("redis") produces:
global:
imageRegistry: docker.io
redis:
enabled: true
replicas: 3Sourcepub fn scope_json_for_subchart(
parent_json: &JsonValue,
subchart_name: &str,
) -> Values
pub fn scope_json_for_subchart( parent_json: &JsonValue, subchart_name: &str, ) -> Values
Scope values for a subchart from raw JsonValue
Same as scope_for_subchart but works with &JsonValue directly,
useful when values are already in JsonValue form (e.g., from TemplateContext).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Values
impl<'de> Deserialize<'de> for Values
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Values
impl RefUnwindSafe for Values
impl Send for Values
impl Sync for Values
impl Unpin for Values
impl UnwindSafe for Values
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)