Skip to main content

Source

Trait Source 

Source
pub trait Source:
    Default
    + Debug
    + Send
    + Sync {
    // Required methods
    fn get_releases<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Release>, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_binary<'life0, 'life1, 'life2, 'life3, 'async_trait, W>(
        &'life0 self,
        release: &'life1 Release,
        variant: &'life2 ReleaseVariant,
        into: &'life3 mut W,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where W: 'async_trait + Write + Send,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

A source of application releases which the UpdateManager can list and download binaries from.

The crate ships GitHubSource which fetches releases from a GitHub repository’s releases API, but you can implement this trait yourself to pull updates from any other location (a custom HTTP endpoint, an S3 bucket, a local directory, …).

A source is responsible for selecting the asset relevant to the running platform: each Release it returns from get_releases should carry, in Release::variant, the asset that should be installed here (for GitHubSource, the asset matching the configured glob pattern) or None if there is none. The manager downloads Release::get_variant.

Implementations must be cheap to construct via Default (the manager uses it for its generic-parameter default) and must be Send + Sync so the manager can be used from async contexts.

Required Methods§

Source

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

List the releases which are available from this source, each carrying the asset relevant to the running platform in Release::variant.

Source

fn get_binary<'life0, 'life1, 'life2, 'life3, 'async_trait, W>( &'life0 self, release: &'life1 Release, variant: &'life2 ReleaseVariant, into: &'life3 mut W, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where W: 'async_trait + Write + Send, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Download the binary for a specific release variant, writing it to the provided sink.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§