Skip to main content

HttpExecutor

Trait HttpExecutor 

Source
pub trait HttpExecutor: Send + Sync {
    // Required method
    fn execute(
        &self,
        request: HttpRequestFactory,
    ) -> Pin<Box<dyn Future<Output = Result<Response, OpenAIError>> + Send + 'static>>;
}
Available on crate features _api and middleware only.
Expand description

Minimal request execution interface used by Client.

The executor sees the replayable factory rather than a built request so it can decide when to rebuild and send. That keeps the retry decision close to execution and avoids forcing every call site to know whether a request body is cloneable.

Required Methods§

Source

fn execute( &self, request: HttpRequestFactory, ) -> Pin<Box<dyn Future<Output = Result<Response, OpenAIError>> + Send + 'static>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§