Trait craft::source::Source
[−]
[src]
pub trait Source: Registry { fn update(&mut self) -> CraftResult<()>; fn download(&mut self, package: &PackageId) -> CraftResult<Package>; fn fingerprint(&self, pkg: &Package) -> CraftResult<String>; fn verify(&self, _pkg: &PackageId) -> CraftResult<()> { ... } }
A Source finds and downloads remote packages based on names and versions.
Required Methods
fn update(&mut self) -> CraftResult<()>
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) -> CraftResult<Package>
The download method fetches the full package for each name and version specified.
fn fingerprint(&self, pkg: &Package) -> CraftResult<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) -> CraftResult<()>
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 chest 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>