pub trait Evaluate: Sealed {
type Output;
// Required method
fn evaluate(&self, ctx: &Context<'_>) -> EvalResult<Self::Output>;
}
Expand description
A trait for evaluating the HCL template and expression sub-languages.
The types implementing this trait must recursively evaluate all HCL templates and expressions in their fields.
This trait is sealed to prevent implementation outside of this crate.
Required Associated Types§
Required Methods§
sourcefn evaluate(&self, ctx: &Context<'_>) -> EvalResult<Self::Output>
fn evaluate(&self, ctx: &Context<'_>) -> EvalResult<Self::Output>
Recursively evaluates all HCL templates and expressions in the implementing type using the
variables and functions declared in the Context
.
See the module-level documentation for usage examples.
Errors
This function fails with an error if:
- an expression evaluates to a value that is not allowed in a given context, e.g. a string occures where a boolean value is expected.
- an operation is performed on values that it’s not applicable to.
- an undefined variable or function is encountered.
- a defined function is called with unexpected arguments.