flowly-service 0.4.13

Flowly is a library of modular and reusable components for building robust pipelines processing audio, video and other.
Documentation
use std::marker::PhantomData;

use flowly_core::Void;
use futures::Stream;

use crate::{Context, Service};

#[derive(Debug, Clone, Copy)]
pub struct Pass<I>(PhantomData<I>);

impl<I: Send> Service<I> for Pass<I> {
    type Out = Result<I, Void>;

    #[inline]
    fn handle(&mut self, input: I, _cx: &Context) -> impl Stream<Item = Self::Out> + Send {
        futures::stream::once(async move { Ok(input) })
    }
}

#[inline]
pub fn flow<I>() -> Pass<I> {
    Pass(PhantomData)
}