apalis_core/backend/poll_strategy/strategies/
stream.rs1use futures_core::Stream;
2
3use crate::backend::poll_strategy::{PollContext, PollStrategy};
4
5#[derive(Debug, Clone)]
7pub struct StreamStrategy<S> {
8 stm: S,
9}
10
11impl<S> StreamStrategy<S>
12where
13 S: Stream<Item = ()> + Unpin + Send + 'static,
14{
15 pub fn new(stm: S) -> Self {
17 Self { stm }
18 }
19}
20
21impl<S> PollStrategy for StreamStrategy<S>
22where
23 S: Stream<Item = ()> + Unpin + Send + 'static,
24{
25 type Stream = S;
26
27 fn poll_strategy(self: Box<Self>, _ctx: &PollContext) -> Self::Stream {
28 self.stm
29 }
30}