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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
pub mod client_streaming; pub mod server_streaming; pub mod streaming; pub mod unary; pub mod unimplemented; use crate::codec::{Codec, Streaming}; use crate::generic::server::{ ClientStreamingService, Grpc, ServerStreamingService, StreamingService, UnaryService, }; use crate::Body; pub fn unary<T, B, R>(service: T, request: http::Request<B>) -> unary::ResponseFuture<T, B, R> where T: UnaryService<R>, R: prost::Message + Default, T::Response: prost::Message, B: Body, { let mut grpc = Grpc::new(Codec::new()); let inner = grpc.unary(service, request); unary::ResponseFuture::new(inner) } pub fn client_streaming<T, R, B>( service: &mut T, request: http::Request<B>, ) -> client_streaming::ResponseFuture<T, Streaming<R, B>> where T: ClientStreamingService<Streaming<R, B>>, R: prost::Message + Default, T::Response: prost::Message, B: Body, { let mut grpc = Grpc::new(Codec::new()); let inner = grpc.client_streaming(service, request); client_streaming::ResponseFuture::new(inner) } pub fn server_streaming<T, B, R>( service: T, request: http::Request<B>, ) -> server_streaming::ResponseFuture<T, B, R> where T: ServerStreamingService<R>, R: prost::Message + Default, T::Response: prost::Message, B: Body, { let mut grpc = Grpc::new(Codec::new()); let inner = grpc.server_streaming(service, request); server_streaming::ResponseFuture::new(inner) } pub fn streaming<T, R, B>( service: &mut T, request: http::Request<B>, ) -> streaming::ResponseFuture<T, Streaming<R, B>> where T: StreamingService<Streaming<R, B>>, R: prost::Message + Default, T::Response: prost::Message, B: Body, { let mut grpc = Grpc::new(Codec::new()); let inner = grpc.streaming(service, request); streaming::ResponseFuture::new(inner) } pub fn unimplemented(message: String) -> unimplemented::ResponseFuture { unimplemented::ResponseFuture::new(message) }