Struct dcl_rpc::stream_protocol::StreamProtocol
source · pub struct StreamProtocol { /* private fields */ }Expand description
It knows how to process all the stream messages for client streams, server streams and bidirectional streams.
And it should be used to consume the stream messages when a stream procedure is executed
Implementations§
source§impl StreamProtocol
impl StreamProtocol
sourcepub fn to_generator<O: Send + Sync + 'static, F: Fn(Vec<u8>) -> O + Send + Sync + 'static>(
self,
transformer: F
) -> Generator<O>
pub fn to_generator<O: Send + Sync + 'static, F: Fn(Vec<u8>) -> O + Send + Sync + 'static>( self, transformer: F ) -> Generator<O>
It consumes the StreamProtocol and returns a Generator.
It allows to pass a closure to transform the values that the internal Generator has.
It transforms the values and sends it to the returned Generator in a backgroun taks for a immediate response.