flarrow_builtins/
transport.rs

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