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§
Sourcetype RequestBody
type RequestBody
The type of the request body.
Required Methods§
Sourcefn 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,
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.endpointas the base of the URI. - Use
client.http_request_builderas the base request builder, since this is garenteed to use the other properties of the client. - Use
client.transportto 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.