Skip to main content

GrpcStreamRequest

Type Alias GrpcStreamRequest 

Source
pub type GrpcStreamRequest = RequestStream<RequestBody>;
Expand description

Client-streaming extractor that yields a stream of T: Message from the request body.

Wraps [http_grpc::stream::RequestStream] with the framework’s RequestBody type.

LIMIT controls the maximum allowed size in bytes for a single gRPC message frame. Defaults to DEFAULT_LIMIT (4 MiB). Set to 0 for unlimited.

§Example

use xitca_web::handler::grpc::{GrpcStreamRequest, Grpc};

// default 4 MiB limit
async fn client_stream(mut stream: GrpcStreamRequest<MyRequest>) -> Grpc<MyReply> {
    while let Some(msg) = stream.message().await? {
        // process each MyRequest
    }
    Grpc(MyReply { .. })
}

Aliased Type§

pub struct GrpcStreamRequest { /* private fields */ }

Trait Implementations§

Source§

impl<'a, 'r, C, B> FromRequest<'a, WebContext<'r, C, B>> for GrpcStreamRequest
where B: BodyStream + Default + 'static,

Source§

type Type<'b> = RequestStream<RequestBody>

Source§

type Error = Error

Source§

async fn from_request( ctx: &'a WebContext<'r, C, B>, ) -> Result<Self, Self::Error>