RawApiCall

Trait RawApiCall 

Source
pub trait RawApiCall: Sized {
    type RequestBody;
    type Output;

    // Required method
    fn request<'life0, 'async_trait, B, T>(
        self,
        client: &'life0 Client<B, T>,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>>
       where B: From<Self::RequestBody> + Sync + 'async_trait + Send,
             T: 'async_trait + Transport<B>,
             Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The lowest level trait for API calls. You probably shouldn’t implement it directly, instead preferring ApiCall, or, for JSON APIs, JsonApiCall and SimpleApiCall.

If you do implement it directly, make sure you properly read the docs for the request method!

Required Associated Types§

Source

type RequestBody

The type of the request body.

Source

type Output

The output type of the call.

Required Methods§

Source

fn request<'life0, 'async_trait, B, T>( self, client: &'life0 Client<B, T>, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Error>> + Send + 'async_trait>>
where B: From<Self::RequestBody> + Sync + 'async_trait + Send, T: 'async_trait + Transport<B>, Self: 'async_trait, 'life0: 'async_trait,

Make a request using a client.

It’s super important to use the client value correctly. You should:

  • Use client.endpoint as the base of the URI.
  • Use client.http_request_builder as the base request builder, since this is garenteed to use the other properties of the client.
  • Use client.transport to make the request.

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§