flowly-service 0.4.13

Flowly is a library of modular and reusable components for building robust pipelines processing audio, video and other.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use futures::Stream;

use crate::Service;

#[derive(Debug, Clone)]
pub struct Chain<S1, S2> {
    pub(crate) service1: S1,
    pub(crate) service2: S2,
}

impl<I, S1: Service<I>, S2: Service<S1::Out>> Service<I> for Chain<S1, S2> {
    type Out = S2::Out;

    fn handle(self, input: impl Stream<Item = I> + Send) -> impl Stream<Item = Self::Out> + Send {
        self.service2.handle(self.service1.handle(input))
    }
}