# `RustQ.Binding.Index`
[🔗](https://github.com/dannote/rustq/blob/v0.11.1/lib/rustq/binding/index.ex#L1)

Lookup table for normalized RustQ callable metadata.

The index stores `RustQ.Binding.Callable` values under local and target-qualified
call keys. Method callables are indexed both by their full Rust signature arity
and, when they include a receiver/self argument, by the Elixir-style call arity
that excludes the receiver. This lets lowering ask for `Canvas.draw_rect(rect)`
even when the Rust signature is `draw_rect(&self, rect: Rect)`.

# `key`

```elixir
@type key() :: {String.t() | nil, String.t(), non_neg_integer()}
```

# `t`

```elixir
@type t() :: %RustQ.Binding.Index{
  by_key: %{optional(key()) =&gt; RustQ.Binding.Callable.t()}
}
```

# `argument_types`

```elixir
@spec argument_types(
  t(),
  String.t() | atom() | nil,
  String.t() | atom(),
  non_neg_integer()
) ::
  [RustQ.Meta.Type.t()] | nil
```

Returns expected argument types for a callable lookup.

# `fetch`

```elixir
@spec fetch(t(), String.t() | atom() | nil, String.t() | atom(), non_neg_integer()) ::
  {:ok, RustQ.Binding.Callable.t()} | :error
```

Fetches a callable by optional target, function name, and call arity.

# `get`

```elixir
@spec get(t(), String.t() | atom() | nil, String.t() | atom(), non_neg_integer()) ::
  RustQ.Binding.Callable.t() | nil
```

Returns a callable by optional target, function name, and call arity or `nil`.

# `method_targets`

```elixir
@spec method_targets(t(), String.t() | atom(), non_neg_integer()) :: [String.t()]
```

Returns method receiver targets for a method name and Elixir-style call arity.

# `new`

```elixir
@spec new([RustQ.Binding.Callable.t()] | t() | nil) :: t()
```

Builds a callable lookup index.

# `put`

```elixir
@spec put(t(), RustQ.Binding.Callable.t()) :: t()
```

Adds a callable to the index under all lookup keys it supports.

# `return_type`

```elixir
@spec return_type(
  t(),
  String.t() | atom() | nil,
  String.t() | atom(),
  non_neg_integer()
) ::
  RustQ.Meta.Type.t() | nil
```

Returns the return type for a callable lookup or `nil` when unknown/unit.

# `unqualified_argument_types`

```elixir
@spec unqualified_argument_types(t(), String.t() | atom(), non_neg_integer()) ::
  [RustQ.Meta.Type.t()] | nil
```

Returns an unqualified free-function signature only when it is unambiguous.

# `unqualified_return_type`

```elixir
@spec unqualified_return_type(t(), String.t() | atom(), non_neg_integer()) ::
  RustQ.Meta.Type.t() | nil
```

Returns an unqualified free-function return type only when it is unambiguous.

---

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