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

pub trait Source: Registry {
    fn update(&mut self) -> CargoResult<()>;
    fn download(&mut self, package: &PackageId) -> CargoResult<Package>;
    fn fingerprint(&self, pkg: &Package) -> CargoResult<String>;
}

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

Required Methods

fn update(&mut self) -> CargoResult<()>

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.

fn download(&mut self, package: &PackageId) -> CargoResult<Package>

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

fn fingerprint(&self, pkg: &Package) -> CargoResult<String>

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.

Implementors