Skip to main content

ServerStreamingService

Trait ServerStreamingService 

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

    // Required method
    fn serve(
        &self,
        request: Request<R>,
    ) -> impl Future<Output = Result<Response<Self::ResponseStream>, Status>>;
}
Available on crate features grpc and http only.
Expand description

A specialization of Service.

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

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<R>, ) -> impl Future<Output = Result<Response<Self::ResponseStream>, Status>>

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

§

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

§

type Response = M2

§

type ResponseStream = S