Expand description
ryo-metadata: Cargo workspace and crate metadata resolution
This crate provides accurate crate name resolution for Rust projects, solving the “crate::” vs actual crate name problem.
§Problem
When analyzing Rust source code, internal references like crate::config
need to be resolved to their actual crate names like ryo_app::config.
§Solution
Use cargo metadata to:
- Discover workspace members
- Map file paths to crate names
- Provide accurate SymbolPath resolution
§Example
ⓘ
use ryo_metadata::WorkspaceResolver;
let resolver = WorkspaceResolver::from_manifest("Cargo.toml")?;
// Get crate name for a file
let crate_name = resolver.crate_for_file("crates/ryo-app/src/lib.rs");
assert_eq!(crate_name, Some("ryo_app"));
// Get all workspace members
for member in resolver.members() {
println!("{}: {}", member.name, member.manifest_path);
}Re-exports§
pub use cargo_metadata;
Structs§
- Crate
Info - Information about a crate in the workspace
- Metadata
- Starting point for metadata returned by
cargo metadata - Metadata
Command - A builder for configuring
cargo metadatainvocation. - Package
- One or more crates described by a single
Cargo.toml - Resolved
Crate Name - A crate name that has been resolved from Cargo.toml
- Resolved
File - A fully resolved file with guaranteed correct crate/module information
- Resolved
Module Path - A module path that has been resolved from file location
- Workspace
Resolver - Resolves file paths to crate names using cargo metadata
Enums§
- Metadata
Error - Errors that can occur during metadata resolution
Type Aliases§
- Result
- Result type for ryo-metadata operations