Trait cargo::core::source::Source
[−]
[src]
pub trait Source: Registry { fn source_id(&self) -> &SourceId; fn update(&mut self) -> CargoResult<()>; fn download(&mut self, package: &PackageId) -> CargoResult<Package>; fn fingerprint(&self, pkg: &Package) -> CargoResult<String>; fn verify(&self, _pkg: &PackageId) -> CargoResult<()> { ... } }
A Source finds and downloads remote packages based on names and versions.
Required Methods
fn source_id(&self) -> &SourceId
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.
Provided Methods
fn verify(&self, _pkg: &PackageId) -> CargoResult<()>
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.
Implementors
impl<'a, T: Source + ?Sized + 'a> Source for Box<T>
impl<'cfg> Source for DirectorySource<'cfg>
impl<'cfg> Source for GitSource<'cfg>
impl<'cfg> Source for PathSource<'cfg>
impl<'cfg> Source for RegistrySource<'cfg>
impl<'cfg> Source for ReplacedSource<'cfg>