Skip to main content

StreamingOperationShape

Trait StreamingOperationShape 

Source
pub trait StreamingOperationShape: SchemaOperationShape {
    // Required methods
    fn deserialize_streaming_input(
        request: Request<RequestBody>,
        protocol: SharedServerProtocol,
    ) -> StreamingInputFuture<Self::Input>;
    fn serialize_streaming_output(
        output: Self::Output,
        protocol: &SharedServerProtocol,
    ) -> Response;
}
Expand description

The generated glue between the HTTP bodies and the streaming members of an operation with an event stream or streaming blob on either side.

Both halves work through the erased protocol handle selected by routing: the generated marshallers and unmarshallers ask it for the payload codec and the event media type, and EventStreamFraming::initial_messages_in_frames decides at runtime whether the non-stream members travel in initial-request and initial-response frames.

An operation that streams on one side only implements the other half in terms of the collected path: DeserializableShape for the input, ServerProtocol::serialize_response for the output.

Required Methods§

Source

fn deserialize_streaming_input( request: Request<RequestBody>, protocol: SharedServerProtocol, ) -> StreamingInputFuture<Self::Input>

Reads the input from an owned request, including its routing extensions.

Generated glue prepares HTTP bindings and the live stream inside the returned future. Request-body collection limits come from the routed operation’s request extension.

Source

fn serialize_streaming_output( output: Self::Output, protocol: &SharedServerProtocol, ) -> Response

Serializes the output: the streaming member becomes the body, the rest the response head.

Response construction is synchronous; the body streams asynchronously, including document-bound blobs.

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§