Derive Macro fav_derive::Api
source · #[derive(Api)]
{
// Attributes available to this derive:
#[api]
}
Expand description
A derive macro helping implemente Api
trait.
§Example
use fav_core::api::Api;
#[derive(Api)]
#[api(endpoint("http://abc.com"), params(&["id", "pwd"]), cookies(&["c1"]), method(POST))]
struct LoginApi;
let api = LoginApi;
assert_eq!(api.endpoint(), "http://abc.com");
assert_eq!(api.params(), &["id", "pwd"]);
assert_eq!(api.cookie_keys(), &["c1"]);
assert_eq!(api.method(), reqwest::Method::POST);