pub trait Client<CustErr> {
    type Request: ClientReq<CustErr> + Send;
    type Response: ClientRes<CustErr> + Send;

    // Required method
    fn send(
        req: Self::Request,
    ) -> impl Future<Output = Result<Self::Response, ServerFnError<CustErr>>> + Send;
}
Expand description

A client defines a pair of request/response types and the logic to send and receive them.

This trait is implemented for things like a browser fetch request or for the reqwest trait. It should almost never be necessary to implement it yourself, unless you’re trying to use an alternative HTTP crate on the client side.

Required Associated Types§

Source

type Request: ClientReq<CustErr> + Send

The type of a request sent by this client.

Source

type Response: ClientRes<CustErr> + Send

The type of a response received by this client.

Required Methods§

Source

fn send( req: Self::Request, ) -> impl Future<Output = Result<Self::Response, ServerFnError<CustErr>>> + Send

Sends the request and receives a response.

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§