Files
ShowenV2/plugins/example-plugin
XiuChengWu e112b2e8b7 chore: add Cargo.toml metadata (description, license, rust-version)
- All crates: rust-version = 1.70, license = MIT
- Root + example-plugin: publish = false (not intended for crates.io)
- plugin-sdk: proper description for potential future publication
2026-03-31 23:26:17 +08:00
..

Example Plugin — 示例动态插件

演示如何使用 showen-plugin-sdk 编写动态插件,并提供可直接打包到 plugin_store/manifest.json 模板。

功能

  • 展示消息路由、配置解析、后台任务、自测以及请求/响应模式
  • 展示 ShowenPlugin trait 的完整实现
  • 编译为 cdylib.so 文件)

编译

cd plugins/example-plugin
cargo build --release

产物: target/release/libshowen_example_plugin.so

安装

.somanifest.json 放入 plugin_store/example-plugin/<version>/ 目录即可被主程序动态加载。

文件

文件 说明
src/lib.rs 插件实现,使用 export_plugin! 宏导出
Cargo.toml crate 配置,类型为 cdylib
manifest.json 动态加载所需的完整清单模板