av_plugins/lib.rs
1//! # av-plugins
2//!
3//! 插件机制与内置扩展(PLAN §6)。
4//!
5//! v1 静态注册:实现放本 crate(或用户自己的插件 crate),在 [`register_all`]
6//! 里用 `av_core::av_plugin!` 宏登记,随二进制编译——零链接器黑魔法、可断点调试。
7//! 动态库加载(libloading + C ABI)仅面向"不开源质检规则包分发"场景,列为 v2。
8
9/// 登记本 crate 提供的全部插件(runtime 启动时调用)。
10pub fn register_all() -> av_core::AvResult<()> {
11 // M9 落地能力在此逐个登记:
12 // 跨模态适配(Modality) / 骨干选型器(Backbone) / 拓扑规则引擎(Rule)…
13 Ok(())
14}
15
16#[cfg(test)]
17mod tests {
18 use av_core::registry::{self, Category};
19
20 use super::*;
21
22 #[test]
23 fn register_all_succeeds() {
24 register_all().unwrap();
25 }
26
27 #[test]
28 fn av_plugin_macro_registers_globally() {
29 av_core::av_plugin!(Rule, "test-macro-rule");
30 assert!(registry::lookup(Category::Rule, "test-macro-rule"));
31 }
32}