Skip to main content

HttpClient

Trait HttpClient 

Source
pub trait HttpClient {
    // Required method
    async fn get(&self, url: &str) -> Result<HttpResponse>;
}
Expand description

HTTP transport used by CollateralClient.

Implementations only need to support GET; the crate buffers responses in memory (see HttpResponse).

The async fn here intentionally has no Send bound. Auto-traits propagate through monomorphization, so callers using a Send impl still get Send futures automatically; callers on single-threaded runtimes don’t pay the Send bound they don’t need.

Required Methods§

Source

async fn get(&self, url: &str) -> Result<HttpResponse>

Issue a GET request and buffer the full response.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl HttpClient for ReqwestHttp

Available on crate feature reqwest only.