Macro implement_service

Source
macro_rules! implement_service {
    ($req:ty, $resp:ident, $resp_payload:ty, $endpoints:expr, $headers:expr) => { ... };
}
Expand description

Macro to implement the Service trait for a given request type ($req) and response structure ($resp). This macro supports both synchronous and asynchronous API calls.

ยงParameters:

  • $req: The request type, representing an API request with payload, headers, and endpoint.
  • $resp: The response structure that wraps the actual payload returned by the API.
  • $resp_payload: The type of the payload inside the response structure.
  • $endpoints: The API endpoint URLs, which may vary depending on conditions (sync/async).
  • $headers: A vector of headers to include in the request.