Skip to main content

Component

Derive Macro Component 

Source
#[derive(Component)]
{
    // Attributes available to this derive:
    #[config]
    #[init]
}
Expand description

导出所有宏定义(Component、Service、configuration、init) Component 派生宏 为结构体自动生成 Component trait 的实现 支持以下属性:

  • #[config]: 标记从配置文件加载的字段
  • #[init("fn_name")]: 标记使用指定函数初始化的字段