pub mod tonic;
use std::fmt::Debug;
#[cfg(any(feature = "client-tonic", feature = "server-tonic"))]
pub use self::tonic::*;
use self::{request::Request, response::Response};
#[async_trait]
pub trait ApiGrpcService: Clone + Send + Sync + 'static {
const NAME: &'static str;
type Rejection: IntoGrpcResponse + Send + Sync + 'static;
async fn call(&self, req: Request) -> Result<Response, Self::Rejection>;
}
#[async_trait]
pub trait FromGrpcRequest: Debug + Send + Sync + 'static {
type Request: Debug + Send + Sync + 'static;
type Rejection: Debug + Send + Sync + 'static;
async fn from_grpc_request(req: Self::Request) -> Result<Self, Self::Rejection>
where
Self: Sized;
}
#[async_trait]
pub trait IntoGrpcRequest: Debug + Send + Sync + 'static {
type Request: Debug + Send + Sync + 'static;
async fn into_grpc_request(self) -> Self::Request;
}
#[async_trait]
pub trait FromGrpcResponse: Debug + Send + Sync + 'static {
type Response: Debug + Send + 'static;
type Rejection: Debug + Send + Sync + 'static;
async fn from_grpc_response(res: Self::Response) -> Result<Self, Self::Rejection>
where
Self: Sized;
}
#[async_trait]
pub trait IntoGrpcResponse: Debug + Send + Sync + 'static {
type Response: Debug + Send + 'static;
async fn into_grpc_response(self) -> Self::Response;
}