artisan 0.11.0

Api RequesT Framework U Like - 你喜欢的 Rust API 请求框架
Documentation
//! 快捷方式 trait 定义
//!
//! 定义插件组合的快捷方式接口。
//!
//! 用于简化多个 API 使用相同插件组合的场景。

use std::collections::HashMap;
use std::sync::Arc;

use serde_json::Value;

use crate::plugin::Plugin;

/// 快捷方式 trait
///
/// 该 trait 是 dyn compatible 的,可以用作 trait object:
///
/// ```ignore
/// let shortcuts: Vec<Box<dyn Shortcut>> = vec![...];
/// ```
pub trait Shortcut {
    /// 返回插件列表
    fn get_plugins(&self, params: &HashMap<String, Value>) -> Vec<Arc<dyn Plugin>>;
}