StreamingService

Trait StreamingService 

pub trait StreamingService<R>:
    Send
    + Sync
    + 'static {
    type Response;
    type ResponseStream: Stream<Item = Result<Self::Response, Status>>;

    // Required method
    fn serve(
        &self,
        request: Request<Streaming<R>>,
    ) -> impl Future<Output = Result<Response<Self::ResponseStream>, Status>>;
}
Expand description

A specialization of Service.

Existing Service implementations with the correct form will automatically implement StreamingService.

Required Associated Types§

type Response

Protobuf response message type

type ResponseStream: Stream<Item = Result<Self::Response, Status>>

Stream of outbound response messages

Required Methods§

fn serve( &self, request: Request<Streaming<R>>, ) -> impl Future<Output = Result<Response<Self::ResponseStream>, Status>>

Serve a the grpc streaming request and return a streaming response, or otherwise an error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl<T, S, M1, M2> StreamingService<M1> for T
where T: Service<Request<Streaming<M1>>, Output = Response<S>, Error = Status>, S: Stream<Item = Result<M2, Status>>,

§

type Response = M2

§

type ResponseStream = S