[][src]Trait cargo::core::source::Source

pub trait Source {
    pub fn source_id(&self) -> SourceId;
pub fn supports_checksums(&self) -> bool;
pub fn requires_precise(&self) -> bool;
pub fn query(
        &mut self,
        dep: &Dependency,
        f: &mut dyn FnMut(Summary)
    ) -> CargoResult<()>;
pub fn fuzzy_query(
        &mut self,
        dep: &Dependency,
        f: &mut dyn FnMut(Summary)
    ) -> CargoResult<()>;
pub fn update(&mut self) -> CargoResult<()>;
pub fn download(&mut self, package: PackageId) -> CargoResult<MaybePackage>;
pub fn finish_download(
        &mut self,
        package: PackageId,
        contents: Vec<u8>
    ) -> CargoResult<Package>;
pub fn fingerprint(&self, pkg: &Package) -> CargoResult<String>;
pub fn describe(&self) -> String;
pub fn add_to_yanked_whitelist(&mut self, pkgs: &[PackageId]);
pub fn is_yanked(&mut self, _pkg: PackageId) -> CargoResult<bool>; pub fn replaced_source_id(&self) -> SourceId { ... }
pub fn query_vec(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>> { ... }
pub fn download_now(
        self: Box<Self>,
        package: PackageId,
        config: &Config
    ) -> CargoResult<Package>
    where
        Self: Sized
, { ... }
pub fn verify(&self, _pkg: PackageId) -> CargoResult<()> { ... }
pub fn is_replaced(&self) -> bool { ... } }

Something that finds and downloads remote packages based on names and versions.

Required methods

pub fn source_id(&self) -> SourceId[src]

Returns the SourceId corresponding to this source.

pub fn supports_checksums(&self) -> bool[src]

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

pub fn requires_precise(&self) -> bool[src]

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

pub fn query(
    &mut self,
    dep: &Dependency,
    f: &mut dyn FnMut(Summary)
) -> CargoResult<()>
[src]

Attempts to find the packages that match a dependency request.

pub fn fuzzy_query(
    &mut self,
    dep: &Dependency,
    f: &mut dyn FnMut(Summary)
) -> CargoResult<()>
[src]

Attempts 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, whereas an Index source may return dependencies that have the same canonicalization.

pub fn update(&mut self) -> CargoResult<()>[src]

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

pub fn download(&mut self, package: PackageId) -> CargoResult<MaybePackage>[src]

Fetches the full package for each name and version specified.

pub fn finish_download(
    &mut self,
    package: PackageId,
    contents: Vec<u8>
) -> CargoResult<Package>
[src]

pub fn fingerprint(&self, pkg: &Package) -> CargoResult<String>[src]

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.

pub fn describe(&self) -> String[src]

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

pub fn add_to_yanked_whitelist(&mut self, pkgs: &[PackageId])[src]

Add a number of crates that should be whitelisted for showing up during queries, even if they are yanked. Currently only applies to registry sources.

pub fn is_yanked(&mut self, _pkg: PackageId) -> CargoResult<bool>[src]

Query if a package is yanked. Only registry sources can mark packages as yanked. This ignores the yanked whitelist.

Loading content...

Provided methods

pub fn replaced_source_id(&self) -> SourceId[src]

Returns the replaced SourceId corresponding to this source.

pub fn query_vec(&mut self, dep: &Dependency) -> CargoResult<Vec<Summary>>[src]

pub fn download_now(
    self: Box<Self>,
    package: PackageId,
    config: &Config
) -> CargoResult<Package> where
    Self: Sized
[src]

pub fn verify(&self, _pkg: PackageId) -> CargoResult<()>[src]

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.

pub fn is_replaced(&self) -> bool[src]

Returns whether a source is being replaced by another here.

Loading content...

Implementations on Foreign Types

impl<'a, T: Source + ?Sized + 'a> Source for Box<T>[src]

pub fn source_id(&self) -> SourceId[src]

Forwards to Source::source_id.

pub fn replaced_source_id(&self) -> SourceId[src]

Forwards to Source::replaced_source_id.

pub fn supports_checksums(&self) -> bool[src]

Forwards to Source::supports_checksums.

pub fn requires_precise(&self) -> bool[src]

Forwards to Source::requires_precise.

pub fn query(
    &mut self,
    dep: &Dependency,
    f: &mut dyn FnMut(Summary)
) -> CargoResult<()>
[src]

Forwards to Source::query.

pub fn fuzzy_query(
    &mut self,
    dep: &Dependency,
    f: &mut dyn FnMut(Summary)
) -> CargoResult<()>
[src]

Forwards to Source::query.

pub fn update(&mut self) -> CargoResult<()>[src]

Forwards to Source::update.

pub fn download(&mut self, id: PackageId) -> CargoResult<MaybePackage>[src]

Forwards to Source::download.

pub fn fingerprint(&self, pkg: &Package) -> CargoResult<String>[src]

Forwards to Source::fingerprint.

pub fn verify(&self, pkg: PackageId) -> CargoResult<()>[src]

Forwards to Source::verify.

impl<'a, T: Source + ?Sized + 'a> Source for &'a mut T[src]

Loading content...

Implementors

impl<'cfg> Source for DirectorySource<'cfg>[src]

impl<'cfg> Source for GitSource<'cfg>[src]

impl<'cfg> Source for PathSource<'cfg>[src]

impl<'cfg> Source for RegistrySource<'cfg>[src]

impl<'cfg> Source for ReplacedSource<'cfg>[src]

Loading content...