Skip to main content

Transport

Trait Transport 

Source
pub trait Transport: Send + Sync {
    // Required method
    fn send(
        &self,
        request: HttpRequest,
    ) -> impl Future<Output = Result<HttpResponse, SDKError>> + Send;
}
Expand description

The transport layer abstraction for executing HTTP requests.

On native targets the returned future must be Send (and the implementor Send + Sync) so transports can be used from multi-threaded async runtimes. On wasm32, browser types reached through the Fetch API (e.g. JsValue, web_sys::Response, the JsFuture returned by wasm_bindgen_futures) are not Send/Sync — wasm is single-threaded, so the bound is dropped there rather than required.

Required Methods§

Source

fn send( &self, request: HttpRequest, ) -> impl Future<Output = Result<HttpResponse, SDKError>> + Send

Sends an HTTP request and returns the response asynchronously.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§