Type Definition jexl_eval::TransformFn

source · []
pub type TransformFn<'a> = Box<dyn Fn(&[Value]) -> Result<'_, Value, Error> + 'a>;
Expand description

TransformFn represents an arbitrary transform function Transform functions take an arbitrary number of serde_json::Valueto represent their arguments and return a serde_json::Value. the transform function itself is responsible for checking if the format and number of the arguments is correct

Returns a Result with an anyhow::Error. This allows consumers to return their own custom errors in the closure, and use .into to convert it into an anyhow::Error. The error message will be perserved