pub struct MultiTargetMetadata { /* private fields */ }Expand description
Multi-target metadata cache for the HYBRID approach
Loads metadata for each target in parallel WITHOUT –all-features. This gives us accurate version resolution per target while avoiding the maximal feature set problem.
Implementations§
Source§impl MultiTargetMetadata
impl MultiTargetMetadata
Sourcepub fn load_parallel(
workspace_root: &Path,
targets: &[String],
) -> RailResult<Self>
pub fn load_parallel( workspace_root: &Path, targets: &[String], ) -> RailResult<Self>
Load metadata for all targets in parallel
Sourcepub fn any(&self) -> Option<&Metadata>
pub fn any(&self) -> Option<&Metadata>
Get metadata for any target (useful when they should all be the same)
Sourcepub fn targets(&self) -> Vec<&str>
pub fn targets(&self) -> Vec<&str>
Get all targets we have metadata for (sorted for deterministic output)
Sourcepub fn workspace_packages(&self) -> Vec<&Package>
pub fn workspace_packages(&self) -> Vec<&Package>
Get workspace packages (same across all targets)
Sourcepub fn all_versions(&self, dep_name: &str) -> HashMap<String, Version>
pub fn all_versions(&self, dep_name: &str) -> HashMap<String, Version>
Get all versions of a dependency across targets (includes transitive deps) Returns map of target -> version NOTE: This includes transitive dependencies - use direct_dep_versions() for direct deps only
Sourcepub fn direct_dep_versions(&self, dep_name: &str) -> HashMap<String, Version>
pub fn direct_dep_versions(&self, dep_name: &str) -> HashMap<String, Version>
Get versions of a dependency that are DIRECT dependencies of workspace members only
This filters out transitive dependencies, ensuring we only unify versions that workspace members explicitly depend on. Returns map of target -> version.
Note: Within each target, cargo’s resolver produces exactly ONE version per crate. We return that resolved version for each target where the dep is a direct dependency.
Sourcepub fn is_transitive_only(&self, dep_name: &str) -> bool
pub fn is_transitive_only(&self, dep_name: &str) -> bool
Check if a dependency is transitive-only (never in direct deps)
Sourcepub fn is_path_dependency(&self, dep_name: &str) -> bool
pub fn is_path_dependency(&self, dep_name: &str) -> bool
Check if a dependency is a path/workspace dependency (not from a registry)
Path dependencies have source: None in cargo metadata.
These cannot be pinned in workspace.dependencies without a registry source,
so we skip them during transitive pinning.
Sourcepub fn all_features(&self, dep_name: &str) -> HashMap<String, HashSet<String>>
pub fn all_features(&self, dep_name: &str) -> HashMap<String, HashSet<String>>
Get features enabled for a package across all targets Returns map of target -> set of features
Sourcepub fn targets_with_dep(&self, dep_name: &str) -> Vec<String>
pub fn targets_with_dep(&self, dep_name: &str) -> Vec<String>
Check which targets include a specific dependency (sorted for deterministic output)
Sourcepub fn find_fragmented_transitives(&self) -> Vec<FragmentedTransitive>
pub fn find_fragmented_transitives(&self) -> Vec<FragmentedTransitive>
Detect transitive dependencies with fragmented features These are candidates for pinning (workspace-hack replacement)
Sourcepub fn compute_msrv_with_config(
&self,
workspace_root: &Path,
msrv_source: MsrvSource,
) -> Option<ComputedMsrv>
pub fn compute_msrv_with_config( &self, workspace_root: &Path, msrv_source: MsrvSource, ) -> Option<ComputedMsrv>
Compute the workspace MSRV with config-driven source selection
Takes into account the existing workspace rust-version and the msrv_source configuration to determine the final MSRV value.
§Arguments
workspace_root- Path to workspace root (for reading existing rust-version)msrv_source- How to determine the final MSRV (deps, workspace, or max)
§Returns
Noneif no MSRV can be determined (no deps have rust-version AND no workspace rust-version)Some(ComputedMsrv)with the final MSRV and metadata about the computation
Source§impl MultiTargetMetadata
impl MultiTargetMetadata
Sourcepub fn package_to_lib_name_map(&self) -> HashMap<String, String>
pub fn package_to_lib_name_map(&self) -> HashMap<String, String>
Build a mapping from package name to library name
In Rust, a crate’s package name (in Cargo.toml) can differ from its
library name (what you use in code). For example:
- Package:
mopa-maintained - Library:
mopa(what you write asuse mopa::...)
The resolved dependency graph uses library names, but Cargo.toml uses package names. This mapping allows correct lookup when detecting unused deps.
Returns a map where:
- Key: package name (e.g., “mopa-maintained”)
- Value: library name normalized with underscores (e.g., “mopa”)
Trait Implementations§
Source§impl Clone for MultiTargetMetadata
impl Clone for MultiTargetMetadata
Source§fn clone(&self) -> MultiTargetMetadata
fn clone(&self) -> MultiTargetMetadata
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MultiTargetMetadata
impl RefUnwindSafe for MultiTargetMetadata
impl Send for MultiTargetMetadata
impl Sync for MultiTargetMetadata
impl Unpin for MultiTargetMetadata
impl UnwindSafe for MultiTargetMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more