Attribute Macro feign_macros::client

source · []
#[client]
Expand description

Make a restful http client

Examlples

#[client(host = "http://127.0.0.1:3000", path = "/user")]
pub trait UserClient {
    #[get(path = "/find_by_id/<id>")]
    async fn find_by_id(&self, #[path] id: i64) -> ClientResult<Option<User>>;
   #[post(path = "/new_user")]
    async fn new_user(&self, #[json] user: &User) -> Result<Option<String>, Box<dyn std::error::Error>>;
}