dfir_lang/graph/ops/null.rs
1use super::{OperatorCategory, OperatorConstraints, NULL_WRITE_FN, RANGE_0};
2
3/// > unbounded number of input streams of any type, unbounded number of output streams of any type.
4///
5/// As a source, generates nothing. As a sink, absorbs anything with no effect.
6///
7/// ```dfir
8/// // should print `1, 2, 3, 4, 5, 6, a, b, c` across 9 lines
9/// null() -> for_each(|_: ()| panic!());
10/// source_iter([1,2,3]) -> map(|i| println!("{}", i)) -> null();
11/// null_src = null();
12/// null_sink = null();
13/// null_src[0] -> for_each(|_: ()| panic!());
14/// // note: use `for_each()` (or `inspect()`) instead of this:
15/// source_iter([4,5,6]) -> map(|i| println!("{}", i)) -> [0]null_sink;
16/// ```
17pub const NULL: OperatorConstraints = OperatorConstraints {
18 name: "null",
19 categories: &[OperatorCategory::Source, OperatorCategory::Sink],
20 hard_range_inn: &(0..=1),
21 soft_range_inn: &(0..=1),
22 hard_range_out: &(0..=1),
23 soft_range_out: &(0..=1),
24 num_args: 0,
25 persistence_args: RANGE_0,
26 type_args: &(0..=1),
27 is_external_input: false,
28 has_singleton_output: false,
29 flo_type: None,
30 ports_inn: None,
31 ports_out: None,
32 input_delaytype_fn: |_| None,
33 write_fn: NULL_WRITE_FN,
34};