Client

Trait Client 

Source
pub trait Client:
    Send
    + Sync
    + 'static {
    type Error: StdError + Send + Sync + 'static;

    // Required method
    fn execute(
        &self,
        req: Request<ReqBody>,
        upgraded: Option<OnUpgrade>,
    ) -> impl Future<Output = Result<Response<ResBody>, Self::Error>> + Send;
}
Expand description

Client trait for implementing different HTTP clients for proxying.

Implement this trait to create custom proxy clients with different backends or configurations.

Required Associated Types§

Source

type Error: StdError + Send + Sync + 'static

Error type returned by the client.

Required Methods§

Source

fn execute( &self, req: Request<ReqBody>, upgraded: Option<OnUpgrade>, ) -> impl Future<Output = Result<Response<ResBody>, Self::Error>> + Send

Execute a request through the proxy client.

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§

Source§

impl Client for ReqwestClient

Available on crate feature reqwest-client only.
Source§

impl Client for UnixSockClient

Available on crate feature unix-sock-client only.
Source§

impl<C> Client for HyperClient<C>
where C: Connect + Clone + Send + Sync + 'static,

Available on crate feature hyper-client only.