# `Wasmex.Components.GuestResource.Discovery`

Discovers guest-owned resources exported by a WIT world.

The returned metadata includes the component's real interface export name,
including its package namespace and version. It can therefore be used
directly for dynamic Wasmtime export lookup without guessing a package path.

# `function_info`

```elixir
@type function_info() :: %{
  wit_name: String.t(),
  elixir_name: String.t(),
  kind: function_kind(),
  arity: non_neg_integer(),
  has_return: boolean()
}
```

# `function_kind`

```elixir
@type function_kind() ::
  :constructor | :method | :async_method | :static | :async_static
```

# `resource_info`

```elixir
@type resource_info() :: %{
  name: String.t(),
  interface: String.t(),
  interface_path: [String.t()],
  constructor_path: [String.t()],
  functions: [function_info()]
}
```

# `from_wit`

```elixir
@spec from_wit(
  String.t(),
  keyword()
) :: {:ok, [resource_info()]} | {:error, String.t()}
```

Returns metadata for all guest resources exported by the selected WIT world.

`:path` is used in parser diagnostics and defaults to `"wit"`. Pass `:world`
when the WIT contains more than one world.

# `get_resource_from_wit`

```elixir
@spec get_resource_from_wit(String.t(), String.t() | atom(), keyword()) ::
  {:ok, resource_info()} | {:error, :not_found | String.t()}
```

Finds one exported guest resource by its WIT name.

---

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