pub trait HttpBackend:
MaybeSend
+ MaybeSync
+ Debug {
// Required method
fn execute(&self, request: Request) -> ExecuteFuture<'_>;
}Expand description
The swappable HTTP transport: it executes a prepared reqwest::Request into a
reqwest::Response.
This is the seam #17 (retry), #20 (middleware), and #21 (WASM) build on: implement it to wrap,
replace, or retry the execute step without touching URL building, auth, decode, streaming, or
pagination. The default ReqwestBackend simply runs the request on a wrapped
reqwest::Client.
Implementations must be [MaybeSend] + [MaybeSync] — Send + Sync on native (the Client is
shared across tasks), vacuous on wasm32 — and Debug (so [super::ClientCore] stays Debug).
The returned future is manually boxed so the trait is object-safe without an async-trait
dependency.
Required Methods§
Sourcefn execute(&self, request: Request) -> ExecuteFuture<'_>
fn execute(&self, request: Request) -> ExecuteFuture<'_>
Execute a prepared request, yielding the raw response or a transport failure. A backend that
fails should wrap the originating reqwest::Error via TransportError::new so
[super::send] can reclassify timeouts/redirects/protocol errors into the taxonomy.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".