Trait maplibre::io::source_client::HttpClient

source ·
pub trait HttpClient: Clone + Sync + Send + 'static {
    // Required method
    fn fetch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        url: &'life1 str
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, SourceFetchError>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

On the web platform futures are not thread-safe (i.e. not Send). This means we need to tell async_trait that these bounds should not be placed on the async trait: https://github.com/dtolnay/async-trait/blob/b70720c4c1cc0d810b7446efda44f81310ee7bf2/README.md#non-threadsafe-futures

Users of this library can decide whether futures from the HTTPClient are thread-safe or not via the future “thread-safe-futures”. Tokio futures are thread-safe.

Required Methods§

source

fn fetch<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, SourceFetchError>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Object Safety§

This trait is not object safe.

Implementors§