pub fn wrap_stream_with_bidir<T, Req, Resp>(
stream: impl Stream<Item = T> + Send + 'static,
content_type: &'static str,
provenance: Vec<String>,
) -> (Arc<BidirChannel<Req, Resp>>, PlexusStream)where
T: Serialize + Send + 'static,
Req: Serialize + DeserializeOwned + Send + Sync + 'static,
Resp: Serialize + DeserializeOwned + Send + Sync + 'static,Expand description
Wrap a typed stream with bidirectional support
Convenience wrapper that creates a BidirChannel and wraps the stream in one call. The channel is returned for use by the activation.
§Type Parameters
T- The type of items in the user’s streamReq- Request type for bidirectional channelResp- Response type for bidirectional channel
§Example
ⓘ
use plexus_core::plexus::{StandardRequest, StandardResponse, wrap_stream_with_bidir};
let (ctx, stream) = wrap_stream_with_bidir::<_, StandardRequest, StandardResponse>(
user_stream,
"interactive.wizard",
vec!["interactive".into()],
);
// ctx can now be used for bidirectional requests
// stream includes both data items and any Request items