Helpers for discovering Rust package metadata through Cargo.
This module wraps cargo metadata so generators can find source roots for
registry, git, and path dependencies without assuming Cargo's on-disk cache
layout.
Summary
Functions
Returns decoded cargo metadata for a manifest.
Returns package metadata by name.
Returns the source root for a package by name.
Returns all package source roots from Cargo metadata.
Returns a web source link for a package source path and line.
Returns a web source link for a package by name, path, and line.
Functions
@spec metadata!(keyword()) :: RustQ.Cargo.Metadata.t()
Returns decoded cargo metadata for a manifest.
Options:
:manifest_path- path toCargo.toml. Defaults to"Cargo.toml".
@spec package!( String.t(), keyword() ) :: RustQ.Cargo.Package.t()
Returns package metadata by name.
Raises if the package is not present in cargo metadata output.
Returns the source root for a package by name.
Raises if the package is not present in cargo metadata output.
Returns all package source roots from Cargo metadata.
The returned map keys are package names and values are source directories
derived from each package's manifest_path.
@spec source_link(RustQ.Cargo.Package.t(), Path.t(), pos_integer()) :: String.t() | nil
Returns a web source link for a package source path and line.
Registry packages currently link to docs.rs source pages. Path packages or
paths outside the package root return nil.
@spec source_link(String.t(), Path.t(), pos_integer(), keyword()) :: String.t() | nil
Returns a web source link for a package by name, path, and line.