Skip to main content

MultiTargetMetadata

Struct MultiTargetMetadata 

Source
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

Source

pub fn load_parallel( workspace_root: &Path, targets: &[String], ) -> RailResult<Self>

Load metadata for all targets in parallel

Source

pub fn get(&self, target: &str) -> Option<&Metadata>

Get metadata for a specific target

Source

pub fn any(&self) -> Option<&Metadata>

Get metadata for any target (useful when they should all be the same)

Source

pub fn targets(&self) -> Vec<&str>

Get all targets we have metadata for (sorted for deterministic output)

Source

pub fn workspace_packages(&self) -> Vec<&Package>

Get workspace packages (same across all targets)

Source

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

Source

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.

Source

pub fn is_transitive_only(&self, dep_name: &str) -> bool

Check if a dependency is transitive-only (never in direct deps)

Source

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.

Source

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

Source

pub fn targets_with_dep(&self, dep_name: &str) -> Vec<String>

Check which targets include a specific dependency (sorted for deterministic output)

Source

pub fn find_fragmented_transitives(&self) -> Vec<FragmentedTransitive>

Detect transitive dependencies with fragmented features These are candidates for pinning (workspace-hack replacement)

Source

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
  • None if 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

Source

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 as use 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

Source§

fn clone(&self) -> MultiTargetMetadata

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.