pub struct Resolve {
graph: Graph<PackageId, HashSet<Dependency>>,
replacements: HashMap<PackageId, PackageId>,
reverse_replacements: HashMap<PackageId, PackageId>,
features: HashMap<PackageId, Vec<InternedString>>,
checksums: HashMap<PackageId, Option<String>>,
metadata: Metadata,
unused_patches: Vec<PackageId>,
public_dependencies: HashMap<PackageId, HashSet<PackageId>>,
version: ResolveVersion,
summaries: HashMap<PackageId, Summary>,
}
Expand description
Represents a fully-resolved package dependency graph. Each node in the graph is a package and edges represent dependencies between packages.
Each instance of Resolve
also understands the full set of features used
for each package.
Fields§
§graph: Graph<PackageId, HashSet<Dependency>>
A graph, whose vertices are packages and edges are dependency specifications
from Cargo.toml
. We need a HashSet
here because the same package
might be present in both [dependencies]
and [build-dependencies]
.
replacements: HashMap<PackageId, PackageId>
Replacements from the [replace]
table.
reverse_replacements: HashMap<PackageId, PackageId>
Inverted version of replacements
.
features: HashMap<PackageId, Vec<InternedString>>
Features enabled for a given package.
checksums: HashMap<PackageId, Option<String>>
Checksum for each package. A SHA256 hash of the .crate
file used to
validate the correct crate file is used. This is None
for sources
that do not use .crate
files, like path or git dependencies.
metadata: Metadata
“Unknown” metadata. This is a collection of extra, unrecognized data
found in the [metadata]
section of Cargo.lock
, preserved for
forwards compatibility.
unused_patches: Vec<PackageId>
[patch]
entries that did not match anything, preserved in
Cargo.lock
as the [[patch.unused]]
table array. Tracking unused
patches helps prevent Cargo from being forced to re-update the
registry every time it runs, and keeps the resolve in a locked state
so it doesn’t re-resolve the unused entries.
public_dependencies: HashMap<PackageId, HashSet<PackageId>>
A map from packages to a set of their public dependencies
version: ResolveVersion
Version of the Cargo.lock
format, see
cargo::core::resolver::encode
for more.
summaries: HashMap<PackageId, Summary>
Implementations§
source§impl Resolve
impl Resolve
pub fn new( graph: Graph<PackageId, HashSet<Dependency>>, replacements: HashMap<PackageId, PackageId>, features: HashMap<PackageId, Vec<InternedString>>, checksums: HashMap<PackageId, Option<String>>, metadata: Metadata, unused_patches: Vec<PackageId>, version: ResolveVersion, summaries: HashMap<PackageId, Summary> ) -> Resolve
sourcepub fn path_to_top<'a>(
&'a self,
pkg: &'a PackageId
) -> Vec<(&'a PackageId, Option<&'a HashSet<Dependency>>)>
pub fn path_to_top<'a>( &'a self, pkg: &'a PackageId ) -> Vec<(&'a PackageId, Option<&'a HashSet<Dependency>>)>
Resolves one of the paths from the given dependent package up to the root.
pub fn register_used_patches(&mut self, patches: &[Summary])
pub fn merge_from(&mut self, previous: &Resolve) -> CargoResult<()>
pub fn contains<Q>(&self, k: &Q) -> boolwhere PackageId: Borrow<Q>, Q: Ord + Eq + ?Sized,
pub fn sort(&self) -> Vec<PackageId>
pub fn iter(&self) -> impl Iterator<Item = PackageId> + '_
pub fn deps( &self, pkg: PackageId ) -> impl Iterator<Item = (PackageId, &HashSet<Dependency>)>
pub fn deps_not_replaced( &self, pkg: PackageId ) -> impl Iterator<Item = (PackageId, &HashSet<Dependency>)>
pub fn replacement(&self, pkg: PackageId) -> Option<PackageId>
pub fn replacements(&self) -> &HashMap<PackageId, PackageId>
pub fn features(&self, pkg: PackageId) -> &[InternedString]
sourcepub fn features_clone(&self) -> HashMap<PackageId, Vec<InternedString>>
pub fn features_clone(&self) -> HashMap<PackageId, Vec<InternedString>>
This is only here for legacy support, it will be removed when switching to the new feature resolver.
pub fn is_public_dep(&self, pkg: PackageId, dep: PackageId) -> bool
pub fn query(&self, spec: &str) -> CargoResult<PackageId>
pub fn specs_to_ids( &self, specs: &[PackageIdSpec] ) -> CargoResult<Vec<PackageId>>
pub fn unused_patches(&self) -> &[PackageId]
pub fn checksums(&self) -> &HashMap<PackageId, Option<String>>
pub fn metadata(&self) -> &Metadata
pub fn extern_crate_name_and_dep_name( &self, from: PackageId, to: PackageId, to_target: &Target ) -> CargoResult<(InternedString, Option<InternedString>)>
fn dependencies_listed( &self, from: PackageId, to: PackageId ) -> &HashSet<Dependency>
sourcepub fn version(&self) -> ResolveVersion
pub fn version(&self) -> ResolveVersion
Returns the version of the encoding that’s being used for this lock file.
pub fn set_version(&mut self, version: ResolveVersion)
pub fn summary(&self, pkg_id: PackageId) -> &Summary
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Resolve
impl !Send for Resolve
impl !Sync for Resolve
impl Unpin for Resolve
impl UnwindSafe for Resolve
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Serialize for Twhere
T: Serialize + ?Sized,
impl<T> Serialize for Twhere T: Serialize + ?Sized,
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<Ok, Error>
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 360 bytes