//! RPC [`tower::Service`] trait. //---------------------------------------------------------------------------------------------------- Use use std::future::Future; use tower::Service; use crate::rpc_error::RpcError; //---------------------------------------------------------------------------------------------------- RpcService /// An RPC [`tower::Service`]. /// /// This trait solely exists to encapsulate the traits needed /// to handle RPC requests and respond with responses - **it is /// not meant to be used directly.** /// /// The `Request` and `Response` are generic and /// are used in the [`tower::Service`] bounds. /// /// The error type is always [`RpcError`]. /// /// There is a blanket implementation that implements this /// trait on types that implement `tower::Service` correctly. /// /// See [`RpcHandler`](crate::RpcHandler) for more information. pub trait RpcService: Clone + Send + Sync + 'static + Service< Request, Response = Response, Error = RpcError, Future: Future> + Send + Sync + 'static, > { } impl RpcService for T where Self: Clone + Send + Sync + 'static + Service< Request, Response = Response, Error = RpcError, Future: Future> + Send + Sync + 'static, > { }