1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Node abstraction and built-in node collection.
//!
//! `Node` is the smallest computation unit in roplat: one input, one output.
//! Topology is not declared by nodes themselves; it is wired at compile time by
//! `#[roplat::system]`.
/// Arithmetic nodes (add/sub/mul/div/pow/abs, etc.).
/// Filter nodes (moving average, rate limiter, low-pass, etc.).
/// I/O nodes (stdout/stderr/debug writers).
/// Logic and comparison nodes.
// pub mod viz; // disabled: depends on resource module which is currently commented out
use Debug;
use crateRoplatError;
/// roplat node trait.
///
/// # Design Boundaries
/// - `process` is on the hot path and returns only `Output` to avoid extra `Result` branching.
/// - Lifecycle errors are surfaced by [`Node::on_init`] and [`Node::on_shutdown`].
/// - Node instances are typically wired by system macros at compile time.
///
/// # Example
/// ```rust
/// use roplat::Node;
/// use roplat::RoplatError;
///
/// struct Inc;
///
/// impl Node for Inc {
/// type Input = i32;
/// type Output = i32;
/// type Error = RoplatError;
///
/// async fn process(&mut self, input: Self::Input) -> Self::Output {
/// input + 1
/// }
/// }
/// ```