Skip to main content

ViewStreamingHandler

Trait ViewStreamingHandler 

Source
pub trait ViewStreamingHandler<ReqView, Res>:
    Send
    + Sync
    + 'static
where ReqView: MessageView<'static> + Send + Sync + 'static, Res: Message + Send + 'static,
{ type Item: Encodable<Res> + Send + 'static; // Required method fn call( &self, ctx: RequestContext, request: OwnedView<ReqView>, ) -> BoxFuture<'static, ServiceResult<ServiceStream<Self::Item>>>; }
Expand description

Trait for server streaming RPC handlers using zero-copy request views.

Required Associated Types§

Source

type Item: Encodable<Res> + Send + 'static

The stream item type. Typically Res itself; may be PreEncoded or MaybeBorrowed for handlers that encode borrowing views per item.

Required Methods§

Source

fn call( &self, ctx: RequestContext, request: OwnedView<ReqView>, ) -> BoxFuture<'static, ServiceResult<ServiceStream<Self::Item>>>

Handle a server streaming RPC request with a zero-copy view.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F, Fut, ReqView, Res, B> ViewStreamingHandler<ReqView, Res> for FnViewStreamingHandler<F>
where F: Fn(RequestContext, OwnedView<ReqView>) -> Fut + Send + Sync + 'static, Fut: Future<Output = ServiceResult<ServiceStream<B>>> + Send + 'static, ReqView: MessageView<'static> + Send + Sync + 'static, Res: Message + Send + 'static, B: Encodable<Res> + Send + 'static,

Source§

type Item = B