pub enum ArgValue {
Value(Value),
PrevRef {
path: String,
},
Array(Vec<ArgValue>),
Object(Vec<(String, ArgValue)>),
}Expand description
A concrete JSON argument or chain-time $prev expression.
See crates/khive-request/docs/api/previous-result.md for path semantics.
Variants§
Value(Value)
A concrete JSON value (no $prev references anywhere inside).
PrevRef
A $prev or $prev.field.path back-reference (chain mode only); empty path = whole result.
Array(Vec<ArgValue>)
Array literal with at least one $prev element; pure-JSON arrays fold to Value(Array).
Object(Vec<(String, ArgValue)>)
Object literal with at least one $prev value; pure-JSON objects fold to Value(Object).
Implementations§
Source§impl ArgValue
impl ArgValue
Sourcepub fn as_value(&self) -> Option<&Value>
pub fn as_value(&self) -> Option<&Value>
Returns the contained Value if this is ArgValue::Value.
Sourcepub fn is_prev_ref(&self) -> bool
pub fn is_prev_ref(&self) -> bool
Returns true if this is a $prev reference.
Sourcepub fn resolve_prev<'a>(&self, prev_result: &'a Value) -> Option<&'a Value>
pub fn resolve_prev<'a>(&self, prev_result: &'a Value) -> Option<&'a Value>
Resolves this reference by borrowing from prev_result.
Returns None for a non-reference, missing field, non-array index target,
or out-of-range index.
Sourcepub fn resolve_all<'a>(&'a self, prev_result: &'a Value) -> Option<Value>
pub fn resolve_all<'a>(&'a self, prev_result: &'a Value) -> Option<Value>
Materializes this argument, returning None if any nested reference misses.
Sourcepub fn find_prev_failure(&self, prev_result: &Value) -> Option<PrevFailure>
pub fn find_prev_failure(&self, prev_result: &Value) -> Option<PrevFailure>
Finds the first $prev reference within this argument that fails to
resolve against prev_result, and explains why. None means every
reference resolves (consistent with resolve_all(prev_result).is_some())
or this argument holds no $prev reference at all.
Walks the same segments as resolve_prev/resolve_all but never
changes what resolves — it exists purely to build an actionable error
message for a resolve_all miss.