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§
Sourcefn new(
client: Client,
gh_api_client: GhApiClient,
data: Arc<Data>,
target_data: Arc<TargetDataErased>,
signature_policy: SignaturePolicy,
) -> Arc<dyn Fetcher>where
Self: Sized,
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
Sourcefn 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 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
Sourcefn find(self: Arc<Self>) -> JoinHandle<Result<bool, FetchError>>
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.
Sourcefn target_meta(&self) -> PkgMeta
fn target_meta(&self) -> PkgMeta
Return finalized target meta.
Sourcefn source_name(&self) -> CompactString
fn source_name(&self) -> CompactString
A short human-readable name or descriptor for the package source
Sourcefn fetcher_name(&self) -> &'static str
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
.
Sourcefn is_third_party(&self) -> bool
fn is_third_party(&self) -> bool
Should return true if the remote is from a third-party source
fn target_data(&self) -> &Arc<TargetDataErased>
Provided Methods§
Sourcefn report_to_upstream(self: Arc<Self>)
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§
impl Fetcher for GhCrateMeta
impl Fetcher for QuickInstall
quickinstall
only.