In-memory index of Rust source metadata parsed by RustQ.Syn.
Use an index when a generator needs to query many Rust files without keeping project-specific source maps. The index stores parsed files by path and offers lookup helpers for impl blocks and methods by target type.
It also indexes Rust use items and type aliases. Generators can inspect
them directly with uses/1 and type_aliases/1, or ask for the public Rust
name that exposes a native/bindings type with public_type_name/2 and
public_type_name!/2. Reexport chains such as pub use paint::Cap as PaintCap; are followed so callers can prefer the crate's public API surface
over internal module names.
Summary
Functions
Returns a cached index for all Rust sources in a Cargo package.
Clears a cached package index.
Fetches an enum by name.
Fetches an enum by name, raising if missing.
Returns all indexed top-level enums.
Builds an index for all Rust sources in a Cargo package.
Builds an index from Rust source file paths.
Returns all indexed top-level impl blocks.
Returns impl blocks whose target type matches target.
Fetches a method from impl blocks matching target.
Fetches a method from impl blocks matching target, raising if missing.
Returns all methods from impl blocks matching target.
Finds the public Rust type name that aliases a target Rust type name.
Finds the public Rust type name that aliases a target Rust type name, raising if missing.
Fetches a top-level type alias by name.
Fetches a top-level type alias by name, raising if missing.
Returns all indexed top-level type aliases.
Fetches a top-level use alias by alias name.
Fetches a top-level use alias by alias name, raising if missing.
Returns all indexed top-level use aliases.
Types
@type t() :: %RustQ.Syn.Index{ files: %{required(Path.t()) => RustQ.Syn.File.t()}, package: RustQ.Cargo.Package.t() | nil }
Functions
Returns a cached index for all Rust sources in a Cargo package.
Clears a cached package index.
@spec enum(t(), String.t()) :: {:ok, RustQ.Syn.Enum.t()} | :error
Fetches an enum by name.
@spec enum!(t(), String.t()) :: RustQ.Syn.Enum.t()
Fetches an enum by name, raising if missing.
@spec enums(t()) :: [RustQ.Syn.Enum.t()]
Returns all indexed top-level enums.
Builds an index for all Rust sources in a Cargo package.
Builds an index from Rust source file paths.
@spec impls(t()) :: [RustQ.Syn.Impl.t()]
Returns all indexed top-level impl blocks.
@spec impls(t(), String.t()) :: [RustQ.Syn.Impl.t()]
Returns impl blocks whose target type matches target.
@spec method(t(), String.t(), String.t()) :: {:ok, RustQ.Syn.Method.t()} | :error
Fetches a method from impl blocks matching target.
@spec method!(t(), String.t(), String.t()) :: RustQ.Syn.Method.t()
Fetches a method from impl blocks matching target, raising if missing.
@spec methods(t(), String.t()) :: [RustQ.Syn.Method.t()]
Returns all methods from impl blocks matching target.
Finds the public Rust type name that aliases a target Rust type name.
Finds the public Rust type name that aliases a target Rust type name, raising if missing.
@spec type_alias(t(), String.t()) :: {:ok, RustQ.Syn.TypeAlias.t()} | :error
Fetches a top-level type alias by name.
@spec type_alias!(t(), String.t()) :: RustQ.Syn.TypeAlias.t()
Fetches a top-level type alias by name, raising if missing.
@spec type_aliases(t()) :: [RustQ.Syn.TypeAlias.t()]
Returns all indexed top-level type aliases.
@spec use_alias(t(), String.t()) :: {:ok, RustQ.Syn.Use.t()} | :error
Fetches a top-level use alias by alias name.
@spec use_alias!(t(), String.t()) :: RustQ.Syn.Use.t()
Fetches a top-level use alias by alias name, raising if missing.
@spec uses(t()) :: [RustQ.Syn.Use.t()]
Returns all indexed top-level use aliases.