Values

Struct Values 

Source
pub struct Values(pub Value);
Expand description

Values container with deep merge capability

Tuple Fields§

§0: Value

Implementations§

Source§

impl Values

Source

pub fn new() -> Self

Create empty values

Source

pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Self>

Load values from a YAML file

Source

pub fn from_yaml(yaml: &str) -> Result<Self>

Parse values from YAML string

Source

pub fn from_json(json: &str) -> Result<Self>

Parse values from JSON string

Source

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)
Source

pub fn merge_all(values: Vec<Values>) -> Self

Merge multiple values in order

Source

pub fn set(&mut self, path: &str, value: JsonValue) -> Result<()>

Set a value by dotted path (e.g., “image.tag”)

Source

pub fn get(&self, path: &str) -> Option<&JsonValue>

Get a value by dotted path

Source

pub fn inner(&self) -> &JsonValue

Get the inner JSON value

Source

pub fn into_inner(self) -> JsonValue

Convert to JSON value

Source

pub fn is_empty(&self) -> bool

Check if values are empty

Source

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.

Source

pub fn scope_for_subchart(&self, subchart_name: &str) -> Values

Scope values for a subchart

When rendering a subchart, it should only see:

  1. Values under <subchart_name>.* in the parent, as its root values
  2. 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: false

Calling scope_for_subchart("redis") produces:

global:
  imageRegistry: docker.io
enabled: true
replicas: 3
Source

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:

  1. Start with subchart’s own values.yaml defaults
  2. Merge in the scoped values from parent
§Arguments
  • subchart_defaults - Values from the subchart’s values.yaml
  • parent_values - Parent’s merged values
  • subchart_name - Name of the subchart (for scoping)
Source

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: 3

Calling export_to_parent("redis") produces:

global:
  imageRegistry: docker.io
redis:
  enabled: true
  replicas: 3
Source

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).

Source

pub fn for_subchart_json( subchart_defaults: Values, parent_json: &JsonValue, subchart_name: &str, ) -> Values

Merge subchart defaults with scoped parent values from JsonValue

Same as for_subchart but accepts &JsonValue for parent values.

Trait Implementations§

Source§

impl Clone for Values

Source§

fn clone(&self) -> Values

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Values

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Values

Source§

fn default() -> Values

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Values

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Values

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,