rogue-runtime 0.1.0

Async RPC Runtime
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::serde::Serialize;
use crate::serde::de::DeserializeOwned;

use crate::{InventoryItemProvider, TypeInfo, async_trait};

/// Trait for messages that can be handled by the runtime
#[async_trait]
pub trait MessageHandler: InventoryItemProvider + Send + Sync {
    type Input: TypeInfo + DeserializeOwned + Serialize + Send + Sync;
    type Output: TypeInfo + DeserializeOwned + Serialize + Send + Sync;

    /// Handle the message
    async fn handle(data: Self::Input) -> Result<Self::Output, String>;
}