# Struct cargo::core::resolver::resolve::Resolve

source ·

    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

source

#### 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

source

#### 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.

source

#### pub fn register_used_patches(&mut self, patches: &[Summary])

source

#### pub fn merge_from(&mut self, previous: &Resolve) -> CargoResult<()>

source

#### pub fn contains<Q>(&self, k: &Q) -> bool
where PackageId: Borrow<Q>, Q: Ord + Eq + ?Sized,

source

#### pub fn sort(&self) -> Vec<PackageId>

source

#### pub fn iter(&self) -> impl Iterator<Item = PackageId> + '_

source

#### pub fn deps( &self, pkg: PackageId ) -> impl Iterator<Item = (PackageId, &HashSet<Dependency>)>

source

#### pub fn deps_not_replaced( &self, pkg: PackageId ) -> impl Iterator<Item = (PackageId, &HashSet<Dependency>)>

source

#### pub fn replacement(&self, pkg: PackageId) -> Option<PackageId>

source

#### pub fn replacements(&self) -> &HashMap<PackageId, PackageId>

source

#### pub fn features(&self, pkg: PackageId) -> &[InternedString]

source

#### 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.

source

#### pub fn is_public_dep(&self, pkg: PackageId, dep: PackageId) -> bool

source

#### pub fn query(&self, spec: &str) -> CargoResult<PackageId>

source

#### pub fn specs_to_ids( &self, specs: &[PackageIdSpec] ) -> CargoResult<Vec<PackageId>>

source

#### pub fn unused_patches(&self) -> &[PackageId]

source

#### pub fn checksums(&self) -> &HashMap<PackageId, Option<String>>

source

#### pub fn metadata(&self) -> &Metadata

source

#### pub fn extern_crate_name_and_dep_name( &self, from: PackageId, to: PackageId, to_target: &Target ) -> CargoResult<(InternedString, Option<InternedString>)>

source

#### fn dependencies_listed( &self, from: PackageId, to: PackageId ) -> &HashSet<Dependency>

source

#### pub fn version(&self) -> ResolveVersion

Returns the version of the encoding that’s being used for this lock file.

source

#### pub fn set_version(&mut self, version: ResolveVersion)

source

#### pub fn summary(&self, pkg_id: PackageId) -> &Summary

## Trait Implementations§

source§

### impl Debug for Resolve

source§

#### fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

### impl PartialEq for Resolve

source§

#### fn eq(&self, other: &Resolve) -> bool

This method tests for `self` and `other` values to be equal, and is used by `==`.
1.0.0 · source§

#### fn ne(&self, other: &Rhs) -> bool

This method tests for `!=`. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

### impl Serialize for Resolve

source§

#### fn serialize<S>(&self, s: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more

## Auto Trait Implementations§

§

### impl Freeze for Resolve

§

### 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> 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> From<T> for T

source§

#### fn from(t: T) -> T

Returns the argument unchanged.

§

### impl<T> Instrument for T

§

#### fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [`Span`], returning an `Instrumented` wrapper. Read more
§

#### fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current `Span`, returning an `Instrumented` wrapper. Read more
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.

§

### impl<T> Pointable for T

§

#### const ALIGN: usize = _

The alignment of pointer.
§

#### type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

#### unsafe fn drop(ptr: usize)

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

### impl<T> Same for T

§

#### type Output = T

Should always be `Self`
source§

### impl<T> Serialize for T
where T: Serialize + ?Sized,

source§

#### fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

source§

#### fn do_erased_serialize( &self, serializer: &mut dyn Serializer ) -> Result<(), ErrorImpl>

source§

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

§

#### 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>,

§

#### 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.
§

### impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

#### fn vzip(self) -> V

§

### impl<T> WithSubscriber for T

§

#### fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more
§

#### fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default `Subscriber` to this type, returning a [`WithDispatch`] wrapper. Read more

## 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