br_addon/
addon.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::any::type_name;
use crate::module::{Module};


/// 插件接口
pub trait Addon {
    /// 插件名称
    fn name(&self) -> String {
        type_name::<Self>().rsplit("::").next().unwrap().to_lowercase()
    }
    /// 功能标题
    fn title(&self) -> &'static str;
    /// 模型分流
    fn module(&mut self, name: &str) -> Result<Box<dyn Module>, String>;
}