Skip to main content

HttpTransport

Trait HttpTransport 

Source
pub trait HttpTransport: Send + Sync {
    // Required method
    fn send<'life0, 'async_trait>(
        &'life0 self,
        request: HttpRequest,
    ) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn download<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        request: HttpRequest,
        progress: &'life1 Progress<'life2>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn fetch_bytes<'life0, 'async_trait>(
        &'life0 self,
        request: HttpRequest,
    ) -> Pin<Box<dyn Future<Output = Result<HttpBytes>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Source

fn send<'life0, 'async_trait>( &'life0 self, request: HttpRequest, ) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn download<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, request: HttpRequest, progress: &'life1 Progress<'life2>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Fetches a binary body (a release archive). progress(received, total) runs after every chunk; returning false cancels the download. The default refuses: only transports that can stream bytes implement it.

Source

fn fetch_bytes<'life0, 'async_trait>( &'life0 self, request: HttpRequest, ) -> Pin<Box<dyn Future<Output = Result<HttpBytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

One GET answered with its raw body and whatever status the host gave (small pictures such as author avatars; redirects, including to a CDN, are followed). The default refuses: only transports that can carry bytes implement it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§