flarrow-builtins 0.3.1

flarrow (flow + arrow) is a rust runtime/framework for building dataflow applications.
Documentation
use crate::prelude::*;

/// Simple sink node that just prints its input to stdout.
#[derive(Node)]
pub struct Printer {
    pub input: RawInput,
}

#[node(runtime = "default_runtime")]
impl Node for Printer {
    async fn new(
        mut inputs: Inputs,
        _: Outputs,
        _: Queries,
        _: Queryables,
        _: serde_yml::Value,
    ) -> Result<Self> {
        Ok(Self {
            input: inputs.raw("in").await?,
        })
    }

    async fn start(mut self: Box<Self>) -> Result<()> {
        while let Ok(msg) = self.input.recv().await {
            println!("{:?}", msg);
        }

        Ok(())
    }
}