Trait HttpRequestor

Source
pub trait HttpRequestor:
    Debug
    + Send
    + Sync {
    // Required method
    fn http_query<'life0, 'life1, 'async_trait, T>(
        &'life0 self,
        method: Method,
        url: &'life1 str,
        data: Option<T>,
    ) -> Pin<Box<dyn Future<Output = Result<Box<[u8]>, HttpRequestError>> + Send + 'async_trait>>
       where T: Serialize + Send + Sync + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn http_post<'life0, 'life1, 'async_trait, T>(
        &'life0 self,
        url: &'life1 str,
        data: T,
    ) -> Pin<Box<dyn Future<Output = Result<Box<[u8]>, HttpRequestError>> + Send + 'async_trait>>
       where T: Serialize + Send + Sync + 'async_trait,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn http_get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        url: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Box<[u8]>, HttpRequestError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Abstraction for an HTTP client that performs HTTP POST with serializable request data.

Required Methods§

Source

fn http_query<'life0, 'life1, 'async_trait, T>( &'life0 self, method: Method, url: &'life1 str, data: Option<T>, ) -> Pin<Box<dyn Future<Output = Result<Box<[u8]>, HttpRequestError>> + Send + 'async_trait>>
where T: Serialize + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Performs HTTP request with optional JSON data to the given URL and gets the JSON response.

Provided Methods§

Source

fn http_post<'life0, 'life1, 'async_trait, T>( &'life0 self, url: &'life1 str, data: T, ) -> Pin<Box<dyn Future<Output = Result<Box<[u8]>, HttpRequestError>> + Send + 'async_trait>>
where T: Serialize + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Performs HTTP POST of JSON data to the given URL and gets the JSON response.

Source

fn http_get<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Box<[u8]>, HttpRequestError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Performs HTTP GET query to the given URL and gets the JSON response.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§