Skip to main content

Crate injection

Crate injection 

Source

Re-exports§

pub use crate::component::Component;
pub use crate::component::Configure;
pub use crate::container::InjectionContainer;

Modules§

component
config
配置模块:提供全局配置加载和管理功能
container
容器模块:实现依赖注入容器的核心功能
core
导出 inventory 宏,用于收集 Bean 定义
definition
定义模块:定义 Bean 和 BeanDefinition 等核心数据结构

Macros§

collect
导出 inventory 宏,用于收集 Bean 定义 Associate a plugin registry with the specified type.
submit
导出 inventory 宏,用于收集 Bean 定义 Enter an element into the plugin registry corresponding to its type.

Traits§

Collect
导出 inventory 宏,用于收集 Bean 定义 Trait bound corresponding to types that can be iterated by inventory::iter.

Type Aliases§

iter
导出 inventory 宏,用于收集 Bean 定义 An iterator over plugins registered of a given type.

Attribute Macros§

configuration
导出所有宏定义(Component、Service、configuration、init) configuration 属性宏 为配置结构体实现 Configure trait 支持可选的 prefix 参数,用于指定配置文件中的键前缀
init
导出所有宏定义(Component、Service、configuration、init) init 属性宏 为异步函数生成无参版本,自动注入依赖 支持 #[config] 属性标记从配置加载的参数

Derive Macros§

Component
导出所有宏定义(Component、Service、configuration、init) Component 派生宏 为结构体自动生成 Component trait 的实现 支持以下属性:
Service
导出所有宏定义(Component、Service、configuration、init) Service 派生宏 与 Component 类似,但额外生成 Axum 提取器实现 可以直接在 Axum 路由处理函数中使用 &ServiceType 作为参数