binstalk_fetchers

Trait Fetcher

Source
pub trait Fetcher: Send + Sync {
    // Required methods
    fn new(
        client: Client,
        gh_api_client: GhApiClient,
        data: Arc<Data>,
        target_data: Arc<TargetDataErased>,
        signature_policy: SignaturePolicy,
    ) -> Arc<dyn Fetcher>
       where Self: Sized;
    fn fetch_and_extract<'life0, 'life1, 'async_trait>(
        &'life0 self,
        dst: &'life1 Path,
    ) -> Pin<Box<dyn Future<Output = Result<ExtractedFiles, FetchError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find(self: Arc<Self>) -> JoinHandle<Result<bool, FetchError>>;
    fn pkg_fmt(&self) -> PkgFmt;
    fn target_meta(&self) -> PkgMeta;
    fn source_name(&self) -> CompactString;
    fn fetcher_name(&self) -> &'static str;
    fn strategy(&self) -> Strategy;
    fn is_third_party(&self) -> bool;
    fn target(&self) -> &str;
    fn target_data(&self) -> &Arc<TargetDataErased>;

    // Provided method
    fn report_to_upstream(self: Arc<Self>) { ... }
}

Required Methods§

Source

fn new( client: Client, gh_api_client: GhApiClient, data: Arc<Data>, target_data: Arc<TargetDataErased>, signature_policy: SignaturePolicy, ) -> Arc<dyn Fetcher>
where Self: Sized,

Create a new fetcher from some data

Source

fn fetch_and_extract<'life0, 'life1, 'async_trait>( &'life0 self, dst: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<ExtractedFiles, FetchError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch a package and extract

Source

fn find(self: Arc<Self>) -> JoinHandle<Result<bool, FetchError>>

Find the package, if it is available for download

This may look for multiple remote targets, but must write (using some form of interior mutability) the best one to the implementing struct in some way so fetch_and_extract can proceed without additional work.

Must return true if a package is available, false if none is, and reserve errors to fatal conditions only.

Source

fn pkg_fmt(&self) -> PkgFmt

Return the package format

Source

fn target_meta(&self) -> PkgMeta

Return finalized target meta.

Source

fn source_name(&self) -> CompactString

A short human-readable name or descriptor for the package source

Source

fn fetcher_name(&self) -> &'static str

A short human-readable name, must contains only characters and numbers and it also must be unique.

It is used to create a temporary dir where it is used for Fetcher::fetch_and_extract.

Source

fn strategy(&self) -> Strategy

The strategy used by this fetcher

Source

fn is_third_party(&self) -> bool

Should return true if the remote is from a third-party source

Source

fn target(&self) -> &str

Return the target for this fetcher

Source

fn target_data(&self) -> &Arc<TargetDataErased>

Provided Methods§

Source

fn report_to_upstream(self: Arc<Self>)

Report to upstream that cargo-binstall tries to use this fetcher. Currently it is only overriden by quickinstall::QuickInstall.

Implementors§

Source§

impl Fetcher for GhCrateMeta

Source§

impl Fetcher for QuickInstall

Available on crate feature quickinstall only.