hydro2_basic_operators/
sink.rs

1// ---------------- [ File: src/sink.rs ]
2crate::ix!();
3
4// --------------------------------------
5// SinkOperator<T>
6// --------------------------------------
7#[derive(NamedItem, Operator, Debug)]
8#[operator(
9    execute="sink",
10    input0="T",
11    input1="T",
12    input2="T",
13    input3="T",
14    opcode="BasicOpCode::Sink"
15)]
16pub struct SinkOperator<T>
17where T: Send + Sync + Debug + Copy
18{
19    name: String,
20    _0: PhantomData<T>,
21}
22
23impl<T> SinkOperator<T>
24where T: Send + Sync + Debug + Copy
25{
26    pub fn with_name(x: impl AsRef<str>) -> Self {
27        Self {
28            name: x.as_ref().to_string(),
29            _0: Default::default()
30        }
31    }
32
33    async fn sink(
34        &self, 
35        _input0: &T, 
36        _input1: &T, 
37        _input2: &T, 
38        _input3: &T
39    ) -> NetResult<()> {
40        info!("SinkOperator => does nothing yet");
41        Ok(())
42    }
43}
44
45impl<T> Default for SinkOperator<T>
46where T: Send + Sync + Debug + Copy
47{
48    fn default() -> Self {
49        SinkOperator::with_name("default")
50    }
51}