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
use Display;
use DeserializeOwned;
use Serialize;
use cratejsonutils;
//多实例
// 使用 macro_rules! 定义派生宏
// 注意:语法为 derive() (struct ...)
// macro_rules! TraitEntity {
// // derive() 规则处理结构体
// derive() (struct $name:ident $($rest:tt)*) => {
// impl TraitEntity for $name {
// fn entity_name() -> &'static str {
// stringify!($name)
// }
// }
// };
// // 可以添加更多规则以支持 enum、union 等
// }