pub enum Value {
Null,
Bool(bool),
Integer(i64),
Float(f64),
String(String),
Bytes(Vec<u8>),
Sequence(Vec<Value>),
Mapping(IndexMap<String, Value>),
}Expand description
A configuration value that may contain unresolved interpolations
The Bytes variant stores raw binary data and serializes to base64 in YAML/JSON.
Variants§
Null
Null value
Bool(bool)
Boolean value
Integer(i64)
Integer value
Float(f64)
Floating point value
String(String)
String value (may contain interpolations like ${env:VAR})
Bytes(Vec<u8>)
Binary data (serializes to base64)
Sequence(Vec<Value>)
Sequence of values
Mapping(IndexMap<String, Value>)
Mapping of string keys to values
Implementations§
Source§impl Value
impl Value
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Check if this value is an integer
Sourcepub fn is_sequence(&self) -> bool
pub fn is_sequence(&self) -> bool
Check if this value is a sequence
Sourcepub fn is_mapping(&self) -> bool
pub fn is_mapping(&self) -> bool
Check if this value is a mapping
Sourcepub fn as_sequence(&self) -> Option<&[Value]>
pub fn as_sequence(&self) -> Option<&[Value]>
Get as slice if this is a Sequence
Sourcepub fn as_mapping(&self) -> Option<&IndexMap<String, Value>>
pub fn as_mapping(&self) -> Option<&IndexMap<String, Value>>
Get as mapping if this is a Mapping
Sourcepub fn get_path(&self, path: &str) -> Result<&Value>
pub fn get_path(&self, path: &str) -> Result<&Value>
Get a value by path (e.g., “database.host” or “servers[0].name”)
Sourcepub fn get_path_mut(&mut self, path: &str) -> Result<&mut Value>
pub fn get_path_mut(&mut self, path: &str) -> Result<&mut Value>
Get a mutable value by path
Sourcepub fn set_path(&mut self, path: &str, value: Value) -> Result<()>
pub fn set_path(&mut self, path: &str, value: Value) -> Result<()>
Set a value at a path, creating intermediate mappings as needed
Sourcepub fn merge(&mut self, other: Value)
pub fn merge(&mut self, other: Value)
Merge another value into this one (deep merge per ADR-004)
Merge semantics:
- Mappings: Deep merge recursively
- Scalars:
otherwins (last-writer-wins) - Sequences:
otherreplaces entirely - Null in other: Removes the key (handled by caller)
- Type mismatch:
otherwins
Sourcepub fn merged(self, other: Value) -> Value
pub fn merged(self, other: Value) -> Value
Create a merged value from two values (non-mutating)
Sourcepub fn merge_tracking_sources(
&mut self,
other: Value,
source: &str,
path_prefix: &str,
sources: &mut HashMap<String, String>,
)
pub fn merge_tracking_sources( &mut self, other: Value, source: &str, path_prefix: &str, sources: &mut HashMap<String, String>, )
Merge another value into this one while tracking source files
Like merge(), but also records which file each leaf value came from.
The sources map is updated to reflect the final source of each path.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
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>,
Source§impl From<Value> for ResolvedValue
impl From<Value> for ResolvedValue
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.