clientix

Attribute Macro clientix 

Source
#[clientix]
Expand description

A procedural macro for building an HTTP client. It includes the following attributes:

  • url - the base part of the client’s URL, e.g. http://localhost:8080
  • path - an additional part of the URL path that precedes method paths
  • async - if true, the client is asynchronous; otherwise, it is blocking

Example:

#[clientix(url = "http://localhost:8080")]
trait ExampleClient {

    #[get(path = "/", consumes = "application/json", produces = "application/json")]
    fn get(&self) -> ClientixResult<ClientixResponse<String>>;

}

The client also supports configuring parameters imperatively. Example:

let client = ExampleClient::config()
    .url("http://localhost:8080")
    .path("/test")
    .setup();