# `CEL.Function`
[🔗](https://github.com/hansihe/pb_ex/blob/v0.2.0/cel_ex/lib/cel/function.ex#L1)

A custom CEL function, registered with `CEL.Env.build/1`'s `:functions`
option. See the "Custom CEL functions" guide.

  * `:name` — the name expressions call it by.
  * `:modes` — how it is called: `:global` (`f(x)`, the default),
    `:receiver` (`x.f(y)`, where `x` is the first argument), or
    `{:namespace, "ns"}` (`ns.f(x)`). A function may list several.
  * `:overloads` — one `CEL.Function.Overload` per signature.

Other fields are used by CEL's built-in functions and may change.

# `args`

```elixir
@type args() :: [pattern()]
```

# `combine`

```elixir
@type combine() :: :assignable | :common
```

Used by CEL's built-in functions.

# `eval`

```elixir
@type eval() :: nil | :intrinsic | {:mfa, mfa_target()} | mfa_target()
```

`{Module, function}`; the other forms are CEL's own.

# `eval_context`

```elixir
@type eval_context() :: :types | :vars | :call
```

Extra arguments an overload's `:eval` receives; see `CEL.Function.Overload`.

# `mode`

```elixir
@type mode() :: :global | :receiver | :intrinsic | {:namespace, String.t()}
```

How expressions call a function; `:intrinsic` is for operators.

# `on_dyn`

```elixir
@type on_dyn() :: :match | :fallback
```

Used by CEL's built-in functions.

# `pattern`

```elixir
@type pattern() :: CEL.Type.t() | {:param, String.t()} | builtin_pattern()
```

An argument or result type: a `t:CEL.Type.t/0`, or `{:param, name}` for a
type parameter. CEL's built-in functions use further forms.

# `result`

```elixir
@type result() :: pattern()
```

# `t`

```elixir
@type t() :: %CEL.Function{
  dynamic_overloads: [CEL.Function.Overload.t()],
  modes: [mode()],
  name: String.t(),
  overloads: [CEL.Function.Overload.t()]
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
