br_addon/addon.rs
use crate::module::Module;
use std::any::type_name;
/// 插件接口
pub trait Addon {
/// 插件名称
fn _name(&self) -> String {
type_name::<Self>()
.rsplit("::")
.next()
.unwrap()
.to_lowercase()
}
/// 插件标题
fn title(&self) -> &'static str;
/// 插件图标
fn icon(&self) -> &'static str {
""
}
/// 功能描述
fn description(&self) -> &'static str {
""
}
fn sort(&self) -> usize {
99
}
/// 模型分流
fn module(&mut self, name: &str) -> Result<Box<dyn Module>, String>;
}