Trait hcl::eval::Evaluate

source ·
pub trait Evaluate: Sealed {
    type Output;

    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§

The type that is returned by evaluate on success.

Required Methods§

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.

Implementations on Foreign Types§

Implementors§