Skip to main content

BidiStreamingHandler

Trait BidiStreamingHandler 

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

Trait for bidirectional streaming RPC handlers.

§Migrating from connectrpc 0.4.x

Item is new in 0.5: hand-written impls add type Item = Res;. See StreamingHandler for details.

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. See StreamingHandler::Item.

Required Methods§

Source

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

Handle a bidi streaming RPC request.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F, Fut, Req, Res, B> BidiStreamingHandler<Req, Res> for FnBidiStreamingHandler<F>
where F: Fn(RequestContext, ServiceStream<Req>) -> Fut + Send + Sync + 'static, Fut: Future<Output = ServiceResult<ServiceStream<B>>> + Send + 'static, Req: Message + Send + 'static, Res: Message + Send + 'static, B: Encodable<Res> + Send + 'static,

Source§

type Item = B