pub trait Plugin {
// Required method
fn addon(name: &str) -> Result<Box<dyn Addon>, String>;
// Provided methods
fn module(name: &str) -> Result<Box<dyn Module>, String> { ... }
fn action(name: &str) -> Result<Box<dyn Action>, String> { ... }
fn api_run(name: &str, request: Request) -> Result<JsonValue, String> { ... }
fn api(name: &str) -> Result<Box<dyn Action>, String> { ... }
fn load_tools(config: ToolsConfig) -> Result<(), String> { ... }
fn get_tools() -> Tools { ... }
fn load_config(name: &str, config: JsonValue) { ... }
fn swagger(
title: &str,
description: &str,
version: &str,
uaturl: &str,
produrl: &str,
tags: JsonValue,
paths: JsonValue,
) -> JsonValue { ... }
fn generate_api_list(
apipath: PathBuf,
path: PathBuf,
index: usize,
) -> Result<Vec<String>> { ... }
}Expand description
插件接口
Required Methods§
Provided Methods§
Sourcefn load_tools(config: ToolsConfig) -> Result<(), String>
fn load_tools(config: ToolsConfig) -> Result<(), String>
加载工具装置
- path 配置文件路径
Sourcefn load_config(name: &str, config: JsonValue)
fn load_config(name: &str, config: JsonValue)
加载全局配置文件
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.