Module cel_interpreter::functions

source ·

Structs§

  • FunctionContext is a context object passed to functions when they are called. It contains references to the target object (if the function is called as a method), the program context (Context) which gives functions access to variables, and the arguments to the function call.

Functions§

  • Returns a boolean value indicating whether every value in the provided list or map met the predicate defined by the provided expression. If called on a map, the predicate is applied to the map keys.
  • Returns true if the target contains the provided argument. The actual behavior depends mainly on the type of the target.
  • Duration parses the provided argument into a Value::Duration value. The argument must be string, and must be in the format of a duration. See the [parse_duration] documentation for more information on the supported formats.
  • Returns true if a string ends with another string.
  • Returns a boolean value indicating whether a or more values in the provided list or map meet the predicate defined by the provided expression. If called on a map, the predicate is applied to the map keys.
  • Returns a boolean value indicating whether only one value in the provided list or map meets the predicate defined by the provided expression. If called on a map, the predicate is applied to the map keys.
  • Filters the provided list by applying an expression to each input item and including the input item in the resulting list, only if the expression returned true.
  • Returns true if the provided argument can be resolved. This function is useful for checking if a property exists on a type before attempting to resolve it. Resolving a property that does not exist will result in a ExecutionError::NoSuchKey error.
  • Maps the provided list to a new list by applying an expression to each input item. This function is intended to be used like the CEL-go map macro: https://github.com/google/cel-spec/blob/master/doc/langdef.md#macros
  • Returns true if a string matches the regular expression.
  • Calculates the size of either the target, or the provided args depending on how the function is called. If called as a method, the target will be used. If called as a function, the first argument will be used.
  • Returns true if a string starts with another string.
  • Timestamp parses the provided argument into a Value::Timestamp value. The