RustQ.Binding.Source (rustq v1.0.0-rc.19)

Copy Markdown View Source

Resolves callable metadata from RustQ modules, Rust source files, and Cargo packages.

This module is the source-backed callable metadata boundary used by RustQ.Meta. It keeps parsing, package indexing, alias-equivalence annotation, caching, and configuration diagnostics out of the macro frontend.

Summary

Functions

The RustQ modules asts name through alias, which a module imports as it does its :callable_modules, the way Elixir resolves a module by its name.

The module an alias in a RustQ module names, when it was written through alias: found among env's aliases, or recorded on the alias by quote in the macro that wrote it. Other aliases are Rust paths.

Resolves external callable metadata configured on a use RustQ.Meta module.

Resolves external static item types configured on a use RustQ.Meta module.

The type aliases declared by a module's callable modules, so its specs and types may name them as their own.

Callables read from a module's :provides files, which join its own in __rustq_callables__/0.

Rust source of a module's :provides files, as the module emits it.

Rust types declared in a module's :provides files, as the Elixir types other modules name them by: KiwiRecord is kiwi_record(). Types with lifetimes or type parameters are left out.

Expands Rust source paths relative to the current project working directory.

Types

rust_package()

@type rust_package() :: String.t() | {String.t(), keyword()}

Functions

aliased_callable_modules(asts, env)

@spec aliased_callable_modules([Macro.t()], Macro.Env.t()) :: [module()]

The RustQ modules asts name through alias, which a module imports as it does its :callable_modules, the way Elixir resolves a module by its name.

aliased_module(alias_ast, env)

@spec aliased_module(Macro.t(), Macro.Env.t()) :: module() | nil

The module an alias in a RustQ module names, when it was written through alias: found among env's aliases, or recorded on the alias by quote in the macro that wrote it. Other aliases are Rust paths.

external_callables(module)

@spec external_callables(module()) :: [RustQ.Binding.Callable.t()]

Resolves external callable metadata configured on a use RustQ.Meta module.

external_static_types(module)

@spec external_static_types(module()) :: %{optional(atom()) => RustQ.Meta.Type.t()}

Resolves external static item types configured on a use RustQ.Meta module.

external_type_aliases(module)

@spec external_type_aliases(module()) :: %{required(module()) => map()}

The type aliases declared by a module's callable modules, so its specs and types may name them as their own.

provided_callables(module)

@spec provided_callables(module()) :: [RustQ.Binding.Callable.t()]

Callables read from a module's :provides files, which join its own in __rustq_callables__/0.

provided_source(module)

@spec provided_source(module()) :: String.t()

Rust source of a module's :provides files, as the module emits it.

provided_types(module)

@spec provided_types(module()) :: %{optional({atom(), 0}) => RustQ.Meta.Type.t()}

Rust types declared in a module's :provides files, as the Elixir types other modules name them by: KiwiRecord is kiwi_record(). Types with lifetimes or type parameters are left out.

rust_source_paths(paths)

@spec rust_source_paths([Path.t()] | Path.t() | nil) :: [Path.t()]

Expands Rust source paths relative to the current project working directory.