saddle_service/
contract.rs1use std::{future::Future, pin::Pin};
2
3use saddle_core::{CallContext, Result};
4
5pub type ServiceFuture<'a, T> = Pin<Box<dyn Future<Output = Result<T>> + Send + 'a>>;
7
8pub trait Service: Send + Sync + 'static {
14 type Request: Send + 'static;
15 type Response: Send + 'static;
16}
17
18pub trait ServiceHandler<S: Service>: Send + Sync + 'static {
20 fn call<'a>(
21 &'a self,
22 context: &'a CallContext,
23 request: S::Request,
24 ) -> ServiceFuture<'a, S::Response>;
25}