Trait cargo::core::source::Source

source ·
pub trait Source {
Show 14 methods fn source_id(&self) -> &SourceId; fn supports_checksums(&self) -> bool; fn requires_precise(&self) -> bool; fn query(
        &mut self,
        dep: &Dependency,
        f: &mut dyn FnMut(Summary)
    ) -> CargoResult<()>; fn fuzzy_query(
        &mut self,
        dep: &Dependency,
        f: &mut dyn FnMut(Summary)
    ) -> CargoResult<()>; fn update(&mut self) -> CargoResult<()>; fn download(&mut self, package: &PackageId) -> CargoResult<MaybePackage>; fn finish_download(
        &mut self,
        package: &PackageId,
        contents: Vec<u8>
    ) -> CargoResult<Package>; fn fingerprint(&self, pkg: &Package) -> CargoResult<String>; fn describe(&self) -> String; fn replaced_source_id(&self) -> &SourceId { ... } fn query_vec(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> { ... } fn verify(&self, _pkg: &PackageId) -> CargoResult<()> { ... } fn is_replaced(&self) -> bool { ... }
}
Expand description

A Source finds and downloads remote packages based on names and versions.

Required Methods

Returns the SourceId corresponding to this source

Returns whether or not this source will return summaries with checksums listed.

Returns whether or not this source will return summaries with the precise field in the source id listed.

Attempt to find the packages that match a dependency request.

Attempt to find the packages that are close to a dependency request. Each source gets to define what close means for it. path/git sources may return all dependencies that are at that uri. where as an Index source may return dependencies that have the same canonicalization.

The update method performs any network operations required to get the entire list of all names, versions and dependencies of packages managed by the Source.

The download method fetches the full package for each name and version specified.

Generates a unique string which represents the fingerprint of the current state of the source.

This fingerprint is used to determine the “fresheness” of the source later on. It must be guaranteed that the fingerprint of a source is constant if and only if the output product will remain constant.

The pkg argument is the package which this fingerprint should only be interested in for when this source may contain multiple packages.

Describes this source in a human readable fashion, used for display in resolver error messages currently.

Provided Methods

Returns the replaced SourceId corresponding to this source

If this source supports it, verifies the source of the package specified.

Note that the source may also have performed other checksum-based verification during the download step, but this is intended to be run just before a crate is compiled so it may perform more expensive checks which may not be cacheable.

Returns whether a source is being replaced by another here

Implementations on Foreign Types

Forwards to Source::source_id

Forwards to Source::replaced_source_id

Forwards to Source::supports_checksums

Forwards to Source::requires_precise

Forwards to Source::query

Forwards to Source::query

Forwards to Source::update

Forwards to Source::download

Forwards to Source::fingerprint

Forwards to Source::verify

Implementors