Skip to main content

StreamSink

Trait StreamSink 

Source
pub trait StreamSink {
    // Required methods
    fn chunk(&mut self, cx: &mut Cx, frame: ServerFrame) -> Result<()>;
    fn end(&mut self, cx: &mut Cx) -> Result<()>;
}
Expand description

Receiver for streamed server frames produced by EvalSite::stream.

Required Methods§

Source

fn chunk(&mut self, cx: &mut Cx, frame: ServerFrame) -> Result<()>

Accept one streamed server frame.

The default EvalSite::stream compatibility path may pass a FrameKind::Response reply through this method. Real streaming sites should emit FrameKind::StreamStart, FrameKind::StreamChunk, and FrameKind::StreamEnd frames instead.

Source

fn end(&mut self, cx: &mut Cx) -> Result<()>

Finish the transport or sink.

Implementations should treat this as idempotent because a FrameKind::StreamEnd frame may already have closed the logical stream.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§