pub trait ResponsiveStream<const CONFIG: u64, LocalMessagesType: ReactiveMessagingSerializer<LocalMessagesType> + Send + Sync + PartialEq + Debug, SenderChannel: FullDuplexUniChannel<ItemType = LocalMessagesType, DerivedItemType = LocalMessagesType> + Send + Sync, StateType: Send + Sync + Clone + Debug> {
// Required method
fn to_responsive_stream<YieldedItemType>(
self,
peer: Arc<Peer<CONFIG, LocalMessagesType, SenderChannel, StateType>>,
item_mapper: impl FnMut(&LocalMessagesType, &Arc<Peer<CONFIG, LocalMessagesType, SenderChannel, StateType>>) -> YieldedItemType,
) -> impl Stream<Item = YieldedItemType>
where Self: Sized + Stream<Item = LocalMessagesType>;
}
Expand description
The implementor of this trait adds a new functionality to Stream
s, allowing the yielded items to be sent out to the peer
Required Methods§
Sourcefn to_responsive_stream<YieldedItemType>(
self,
peer: Arc<Peer<CONFIG, LocalMessagesType, SenderChannel, StateType>>,
item_mapper: impl FnMut(&LocalMessagesType, &Arc<Peer<CONFIG, LocalMessagesType, SenderChannel, StateType>>) -> YieldedItemType,
) -> impl Stream<Item = YieldedItemType>
fn to_responsive_stream<YieldedItemType>( self, peer: Arc<Peer<CONFIG, LocalMessagesType, SenderChannel, StateType>>, item_mapper: impl FnMut(&LocalMessagesType, &Arc<Peer<CONFIG, LocalMessagesType, SenderChannel, StateType>>) -> YieldedItemType, ) -> impl Stream<Item = YieldedItemType>
Causes the Stream
elements to be sent to peer
, applying the item_mapper
closure for elements downstream –
upgrades the self Stream
(of non-fallible & non-future input items of the LocalMessagesType
) to another Stream
that will consume & send all input items to peer