Trait ApiRequest

Source
pub trait ApiRequest {
    type Output: DeserializeOwned;

    // Required method
    fn send(&self) -> impl Future<Output = ApiResponse<Self::Output>> + Send;
}
Expand description

Trait for implementing API requests.

This trait defines the interface for all API requests. It requires implementing the Output associated type and the send method.

Required Associated Types§

Source

type Output: DeserializeOwned

The type of the response to deserialize to.

Required Methods§

Source

fn send(&self) -> impl Future<Output = ApiResponse<Self::Output>> + Send

Build the request and send it to the API.

§Returns

A Future that resolves to an ApiResponse containing either the response data or an error.

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§