RustQ.Binding.Callable (rustq v0.8.0)

Copy Markdown View Source

Normalized callable signature metadata for RustQ lowering and binding generation.

A callable turns parsed RustQ.Syn function/method metadata into a shape that Rusty-Elixir lowering can query without depending on raw Syn nodes. Argument and return types are converted to RustQ.Meta.Type via RustQ.Spec.from_syn/1. This is the lookup-friendly signature layer needed before type-driven propagation inference can decide whether a call should lower with Rust ?.

Summary

Functions

Builds callable metadata from a resolved native method descriptor.

Builds callable metadata from a RustQ @spec.

Builds callable metadata from a parsed Rust free function.

Builds callable metadata from a parsed Rust impl method.

Returns the callable return type or raises when the callable returns unit.

Types

arg()

@type arg() :: %{
  name: String.t() | nil,
  type: RustQ.Meta.Type.t(),
  syn: RustQ.Syn.Arg.t()
}

t()

@type t() :: %RustQ.Binding.Callable{
  args: [arg()],
  docs: [String.t()],
  kind: :function | :method,
  name: String.t(),
  native_ref: RustQ.Native.Ref.t() | nil,
  returns: RustQ.Meta.Type.t() | nil,
  source_line: pos_integer() | nil,
  source_path: Path.t() | nil,
  source_url: String.t() | nil,
  syn: RustQ.Syn.Function.t() | RustQ.Syn.Method.t() | nil,
  target: String.t() | nil
}

Functions

from_native_descriptor(descriptor)

@spec from_native_descriptor(RustQ.Native.Descriptor.t()) :: t()

Builds callable metadata from a resolved native method descriptor.

from_spec(name, args, returns)

@spec from_spec(atom(), [RustQ.Meta.Type.t()], RustQ.Meta.Type.t()) :: t()

Builds callable metadata from a RustQ @spec.

from_syn_function(function)

@spec from_syn_function(RustQ.Syn.Function.t()) :: t()

Builds callable metadata from a parsed Rust free function.

from_syn_method(method, opts \\ [])

@spec from_syn_method(
  RustQ.Syn.Method.t(),
  keyword()
) :: t()

Builds callable metadata from a parsed Rust impl method.

return_type!(callable)

@spec return_type!(t()) :: RustQ.Meta.Type.t()

Returns the callable return type or raises when the callable returns unit.