Struct cargo::core::registry::PackageRegistry [−][src]
This structure represents a registry of known packages. It internally
contains a number of Box<Source>
instances which are used to load a
Package
from.
The resolution phase of Cargo uses this to drive knowledge about new packages as well as querying for lists of new packages. It is here that sources are updated (e.g., network operations) and overrides are handled.
The general idea behind this registry is that it is centered around the
SourceMap
structure, contained within which is a mapping of a SourceId
to
a Source
. Each Source
in the map has been updated (using network
operations if necessary) and is ready to be queried for packages.
Implementations
impl<'cfg> PackageRegistry<'cfg>
[src]
pub fn new(config: &'cfg Config) -> CargoResult<PackageRegistry<'cfg>>
[src]
pub fn get(self, package_ids: &[PackageId]) -> CargoResult<PackageSet<'cfg>>
[src]
pub fn add_sources(
&mut self,
ids: impl IntoIterator<Item = SourceId>
) -> CargoResult<()>
[src]
&mut self,
ids: impl IntoIterator<Item = SourceId>
) -> CargoResult<()>
pub fn add_preloaded(&mut self, source: Box<dyn Source + 'cfg>)
[src]
pub fn add_override(&mut self, source: Box<dyn Source + 'cfg>)
[src]
pub fn add_to_yanked_whitelist(&mut self, iter: impl Iterator<Item = PackageId>)
[src]
pub fn register_lock(&mut self, id: PackageId, deps: Vec<PackageId>)
[src]
pub fn patch(&mut self, url: &Url, deps: &[Dependency]) -> CargoResult<()>
[src]
Insert a [patch]
section into this registry.
This method will insert a [patch]
section for the url
specified,
with the given list of dependencies. The url
specified is the URL of
the source to patch (for example this is crates-io
in the manifest).
The deps
is an array of all the entries in the [patch]
section of
the manifest.
Here the deps
will be resolved to a precise version and stored
internally for future calls to query
below. It’s expected that deps
have had lock_to
call already, if applicable. (e.g., if a lock file was
already present).
Note that the patch list specified here will not be available to
query
until lock_patches
is called below, which should be called
once all patches have been added.
pub fn lock_patches(&mut self)
[src]
Lock all patch summaries added via patch
, making them available to
resolution via query
.
This function will internally lock
each summary added via patch
above now that the full set of patch
packages are known. This’ll allow
us to correctly resolve overridden dependencies between patches
hopefully!
pub fn patches(&self) -> Vec<Summary>
[src]
pub fn lock(&self, summary: Summary) -> Summary
[src]
This function is used to transform a summary to another locked summary if possible. This is where the concept of a lock file comes into play.
If a summary points at a package ID which was previously locked, then we override the summary’s ID itself, as well as all dependencies, to be rewritten to the locked versions. This will transform the summary’s source to a precise source (listed in the locked version) as well as transforming all of the dependencies from range requirements on imprecise sources to exact requirements on precise sources.
If a summary does not point at a package ID which was previously locked, or if any dependencies were added and don’t have a previously listed version, we still want to avoid updating as many dependencies as possible to keep the graph stable. In this case we map all of the summary’s dependencies to be rewritten to a locked version wherever possible. If we’re unable to map a dependency though, we just pass it on through.
Trait Implementations
impl<'cfg> Registry for PackageRegistry<'cfg>
[src]
fn query(
&mut self,
dep: &Dependency,
f: &mut dyn FnMut(Summary),
fuzzy: bool
) -> CargoResult<()>
[src]
&mut self,
dep: &Dependency,
f: &mut dyn FnMut(Summary),
fuzzy: bool
) -> CargoResult<()>
fn describe_source(&self, id: SourceId) -> String
[src]
fn is_replaced(&self, id: SourceId) -> bool
[src]
fn query_vec(
&mut self,
dep: &Dependency,
fuzzy: bool
) -> CargoResult<Vec<Summary>>
[src]
&mut self,
dep: &Dependency,
fuzzy: bool
) -> CargoResult<Vec<Summary>>
Auto Trait Implementations
impl<'cfg> !RefUnwindSafe for PackageRegistry<'cfg>
impl<'cfg> !Send for PackageRegistry<'cfg>
impl<'cfg> !Sync for PackageRegistry<'cfg>
impl<'cfg> Unpin for PackageRegistry<'cfg>
impl<'cfg> !UnwindSafe for PackageRegistry<'cfg>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,