wplug/src/plugin.rs

44 lines
847 B
Rust
Raw Normal View History

2022-03-28 17:19:23 +04:00
use std::{collections::HashMap, sync::Arc};
use toml::Value;
use crate::{metadata::PluginMetadata, Error};
pub struct PluginApiInfo {}
pub struct PluginInfo {
pub api: PluginApiInfo,
pub options: HashMap<String, Value>,
}
pub struct Plugin {
metadata: Arc<PluginMetadata>,
}
impl Plugin {
pub fn metadata(&self) -> Result<PluginMetadata, Error> {
unimplemented!()
}
pub fn enumerate_callables(&self) -> impl Iterator<Item = ()> {
vec![].into_iter()
}
// Plugin API
pub async fn initialize(&mut self) -> Result<(), Error> {
unimplemented!()
}
pub async fn destroy(&mut self) {}
pub async fn handle(&self, cmd_id: String, args: Vec<Value>) -> Result<Value, Error> {
unimplemented!()
}
}
pub struct PluginCall {
name: String,
args: Vec<Value>,
}