Skip to main content

flowly_service/
stub.rs

1use std::marker::PhantomData;
2
3use futures::Stream;
4
5use crate::{Context, Service};
6
7#[inline]
8pub fn stub<O>() -> Stub<O> {
9    Stub(PhantomData)
10}
11
12#[derive(Debug, Clone, Copy)]
13pub struct Stub<O>(PhantomData<O>);
14
15impl<I: Send, O: Send> Service<I> for Stub<O> {
16    type Out = O;
17
18    fn handle(&mut self, _: I, _cx: &Context) -> impl Stream<Item = Self::Out> + Send {
19        futures::stream::empty()
20    }
21}