1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
use TokenStream;
/// 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;
///
/// # fn main() {
/// 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);
/// # }
/// ```
/// A derive macro helping implemente [`Attr`] trait.
/// # Example
/// ```
/// use fav_core::attr::Attr;
///
/// #[derive(Attr)]
/// struct Res {
/// id: i32,
/// title: String,
/// }
///
/// #[derive(Attr)]
/// #[attr(id(res_id), title(res_name))]
/// struct Res_ {
/// res_id: i32,
/// res_name: String,
/// }
/// ```
/// Default fields are `id` and `title`.
/// In practice, the `Res` is comming from `protobuf-codegen`,
/// making the attribute `attr` `title` refer to the fields is needed.
/// A derive macro helping implemente [`Status`] trait.
/// # Example
/// ```
/// use fav_core::status::Status;
///
/// #[derive(Status)]
/// struct Res {
/// status: i32,
/// }
///
/// #[derive(Status)]
/// #[status(my_status)]
/// struct Res_ {
/// my_status: i32,
/// }
/// ```
/// Default field is `status`.
/// In practice, the `Res` is comming from `protobuf-codegen`,
/// making the attribute `status` refer to the field is needed.
/// A derive macro helping implemente [`Owner`] trait.