Trait ResponsiveStream

Source
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 Streams, allowing the yielded items to be sent out to the peer

Required Methods§

Source

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>,

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

Implementors§

Source§

impl<const CONFIG: u64, T, LocalMessagesType: ReactiveMessagingSerializer<LocalMessagesType> + Send + Sync + PartialEq + Debug, SenderChannel: FullDuplexUniChannel<ItemType = LocalMessagesType, DerivedItemType = LocalMessagesType> + Send + Sync, StateType: Send + Sync + Clone + Debug> ResponsiveStream<CONFIG, LocalMessagesType, SenderChannel, StateType> for T
where T: Stream<Item = LocalMessagesType> + ?Sized,