1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::path::PathBuf;

use error::PluginError;
use futures::Future;
use serde::{Deserialize, Serialize};

pub mod error;
mod test;

pub use derive_io_plugin::IoPlugin;

pub trait IoPlugin<
    MessageType: Serialize + for<'a> Deserialize<'a>,
    ResponseType: Serialize + for<'a> Deserialize<'a>,
>
{
    fn init(
        message: MessageType,
        plugin_file: PathBuf,
    ) -> Box<dyn Future<Output = Result<Self, PluginError>>>
    where
        Self: Sized;
    fn message(message: MessageType)
        -> Box<dyn Future<Output = Result<ResponseType, PluginError>>>;
}