pub trait PathAccessor<F: EvalContextFamily>:
Debug
+ Send
+ Sync {
// Required methods
fn get<'a>(&self, ctx: &F::Context<'a>, fields: &[Field]) -> Result<Value>;
fn set<'a>(
&self,
ctx: &mut F::Context<'a>,
fields: &[Field],
value: &Value,
) -> Result<()>;
}Expand description
Trait for accessing (reading and writing) path values in the context.
The evaluator calls get and set with a slice
of Fields representing the structured path. Each field carries its own name and index
keys; path interpretation is the integrator’s responsibility.
The fields slice is pre-allocated at parse time and passed by reference at execution time,
so the hot path involves zero allocation and zero copy.
The type parameter F is the EvalContextFamily that determines the concrete context type.
The lifetime on F::Context<'a> is introduced per method call, so PathAccessor<F> itself
carries no lifetime and can be stored in Arc<dyn PathAccessor<F>>.
Required Methods§
Sourcefn get<'a>(&self, ctx: &F::Context<'a>, fields: &[Field]) -> Result<Value>
fn get<'a>(&self, ctx: &F::Context<'a>, fields: &[Field]) -> Result<Value>
Get the value at this path.
fields contains the structured path segments with per-field index keys.
Path interpretation, including indexing (e.g. ["key"], [0]), is not implemented by
OTTL; the integrator must implement this method. For applying index keys to a value, use
crate::helpers::apply_indexes.