Expand description
High-level APIs for executing the resolver.
This module provides functions for running the resolver given a workspace, including loading
the Cargo.lock file and checking if it needs updating.
There are roughly 3 main functions:
resolve_ws: A simple, high-level function with no options.resolve_ws_with_opts: A medium-level function with options like user-provided features. This is the most appropriate function to use in most cases.resolve_with_previous: A low-level function for running the resolver, providing the most power and flexibility.
§Data Structures
Workspace: Usually created bycrate::util::command_prelude::ArgMatchesExt::workspacewhich discovers the root of the workspace, and loads all the workspace members as aPackageobjectPackageRegistry: The primary interface for how the dependency resolver finds packages. It contains theSourceMap, and handles things like the[patch]table. The dependency resolver sends a query to thePackageRegistryto “get me all packages that match this dependency declaration”. TheRegistrytrait provides a generic interface to thePackageRegistry, but this is only used for providing an alternate implementation of thePackageRegistryfor testing.SourceMap: Map of all available sources.Source: An abstraction for something that can fetch packages (a remote registry, a git repo, the local filesystem, etc.). Check out the source implementations for all the details about registries, indexes, git dependencies, etc.SourceId: A unique identifier for a source.
Summary: A of aManifest, and is essentially the information that can be found in a registry index. Queries against thePackageRegistryyields aSummary. The resolver uses the summary information to build the dependency graph.
PackageSet— Contains all thePackageobjects. This works with theDownloadsstruct to coordinate downloading packages. It has a reference to theSourceMapto get theSourceobjects which tell theDownloadsstruct which URLs to fetch.
Structs§
- Specs
AndResolved Features - Pair of package specs requested for compilation along with enabled features.
- Workspace
Resolve - Result for
resolve_ws_with_opts.
Constants§
Functions§
- add_
overrides - Read the
pathsconfiguration variable to discover all path overrides that have been configured. - emit_
warnings_ 🔒of_ unused_ patches - Emits warnings of unused patches case by case.
- get_
resolved_ packages - lock_
replacements 🔒 - Locks each
[replace]entry to a specific Package ID if the lockfile contains any corresponding previous replacement. - master_
branch_ 🔒git_ source - register_
patch_ 🔒entries - Informs
registryandversion_prefthat[patch]entries are available and preferable for the dependency resolution. - register_
previous_ 🔒locks - In this function we’re responsible for informing the
registryof all locked dependencies from the previous lock file we had,resolve. - resolve_
with_ previous - Resolves all dependencies for a package using an optional previous instance of resolve to guide the resolution process.
- resolve_
with_ 🔒registry - resolve_
ws - Resolves all dependencies for the workspace using the previous lock file as a guide if present.
- resolve_
ws_ with_ opts - Resolves dependencies for some packages of the workspace,
taking into account
pathsoverrides and activated features.
Type Aliases§
- Keep 🔒
- Filter for keep using Package ID from previous lockfile.