Expand description
§cool-plugin
cool-admin Rust 插件系统。
§功能特性
- 🔌 插件生命周期管理
- 📦 插件注册和发现
- 🔧 插件配置
- 🪝 钩子系统
§快速开始
ⓘ
use cool_plugin::prelude::*;
#[derive(Default)]
struct MyPlugin;
#[async_trait]
impl Plugin for MyPlugin {
fn info(&self) -> PluginInfo {
PluginInfo {
name: "my-plugin".to_string(),
key: "my-plugin".to_string(),
version: "1.0.0".to_string(),
..Default::default()
}
}
async fn ready(&mut self) -> PluginResult<()> {
// 插件就绪
Ok(())
}
}Modules§
- hook_
names - 预定义的钩子名称
- prelude
- 预导入模块
Structs§
- Base
Exception - 异常基类
- Cache
Options - 缓存配置选项
- Cool
Comm Exception - 通用异常
- Cool
Core Exception - 核心异常
- Cool
Validate Exception - 验证异常
- ErrInfo
- 错误提示
- Event
- 事件名称
- FsCache
Store - 文件系统缓存存储
- Global
Config - 全局配置
- Hook
Context - 钩子上下文
- Hook
Manager - 钩子管理器
- Local
Upload Hook - 本地文件上传钩子
- Mode
- 上传模式
- Path
Validator - 路径安全验证工具
- Plugin
Data - 插件数据
- Plugin
Info - 插件信息
- Plugin
Installer - 插件安装器
- Plugin
Registry - 插件注册表
- Plugin
Service - 插件服务
- ResCode
Config - ResMessage
- 返回信息
- ResMessage
Config - Upload
Context - 上传上下文
Enums§
- Cache
Error - 缓存错误
- Check
Result - 插件检查结果
- Installer
Error - 插件安装错误
- Mode
Type - 上传模式类型
- Plugin
Error - 插件错误
- Plugin
Status - 插件状态
- ResCode
- 返回码
- Upload
Error - 上传错误
Traits§
- Hook
- 钩子 trait
- Plugin
- 插件 trait
- Upload
Hook - 上传钩子 trait
Functions§
- create_
cache_ store - 创建缓存存储的便捷函数
- global_
hook_ manager - 获取全局钩子管理器
- global_
plugin_ registry - 获取全局插件注册表
- global_
plugin_ service - 获取全局插件服务