flarrow_builtins/
printer.rs

1use crate::prelude::*;
2
3/// Simple sink node that just prints its input to stdout.
4#[derive(Node)]
5pub struct Printer {
6    pub input: RawInput,
7}
8
9#[node(runtime = "default_runtime")]
10impl Node for Printer {
11    async fn new(
12        mut inputs: Inputs,
13        _: Outputs,
14        _: Queries,
15        _: Queryables,
16        _: serde_yml::Value,
17    ) -> Result<Self> {
18        Ok(Self {
19            input: inputs.raw("in").await?,
20        })
21    }
22
23    async fn start(mut self: Box<Self>) -> Result<()> {
24        while let Ok(msg) = self.input.recv().await {
25            println!("{:?}", msg);
26        }
27
28        Ok(())
29    }
30}