Skip to main content

ReleaseProvider

Trait ReleaseProvider 

Source
pub trait ReleaseProvider:
    Send
    + Sync
    + 'static {
    // Required methods
    fn latest_release<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Release, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn release_by_tag<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tag: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Release, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list_releases<'life0, 'async_trait>(
        &'life0 self,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Release>, ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn download_asset<'life0, 'life1, 'async_trait>(
        &'life0 self,
        asset: &'life1 ReleaseAsset,
    ) -> Pin<Box<dyn Future<Output = Result<(Box<dyn AsyncRead + Send + Unpin>, u64), ProviderError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Read-only release-source abstraction.

Consumers hold Arc<dyn ReleaseProvider>. Implementations are registered at link time via RELEASE_PROVIDERS and resolved via lookup.

Every method is async so network I/O doesn’t block the caller’s runtime. The trait is dyn-safe via async-trait; consider native async fn in trait again in v0.3 once the ecosystem settles on a dyn-safety story (see the v0.1 spec § 8 O2).

Required Methods§

Source

fn latest_release<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Release, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Fetch metadata for the repository’s latest non-draft, non- prerelease release.

Source

fn release_by_tag<'life0, 'life1, 'async_trait>( &'life0 self, tag: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Release, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch metadata for a specific tag. Returns ProviderError::NotFound when the tag does not exist or is a draft release the caller lacks permission to see.

Source

fn list_releases<'life0, 'async_trait>( &'life0 self, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<Release>, ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List up to limit most-recent releases, newest first. Includes prereleases (caller filters) but excludes drafts for unauthenticated callers.

Source

fn download_asset<'life0, 'life1, 'async_trait>( &'life0 self, asset: &'life1 ReleaseAsset, ) -> Pin<Box<dyn Future<Output = Result<(Box<dyn AsyncRead + Send + Unpin>, u64), ProviderError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stream an asset’s bytes.

Returns an AsyncRead reader plus the content-length the host reported (when available, otherwise 0 — the caller should not rely on this value to size allocations).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§