pub trait Node<const IN: usize, const OUT: usize, InP, OutP>{
Show 13 methods
// Required methods
fn describe_capabilities(&self) -> NodeCapabilities;
fn input_acceptance(&self) -> [PlacementAcceptance; IN];
fn output_acceptance(&self) -> [PlacementAcceptance; OUT];
fn policy(&self) -> NodePolicy;
fn set_policy(&mut self, policy: NodePolicy);
fn node_kind(&self) -> NodeKind;
fn initialize<C, Tel>(
&mut self,
clock: &C,
telemetry: &mut Tel,
) -> Result<(), NodeError>
where Tel: Telemetry;
fn start<C, Tel>(
&mut self,
_clock: &C,
_telemetry: &mut Tel,
) -> Result<(), NodeError>
where Tel: Telemetry;
fn process_message<C>(
&mut self,
msg: &Message<InP>,
sys_clock: &C,
) -> Result<ProcessResult<OutP>, NodeError>
where C: PlatformClock + Sized;
fn on_watchdog_timeout<C, Tel>(
&mut self,
_clock: &C,
_telemetry: &mut Tel,
) -> Result<StepResult, NodeError>
where C: PlatformClock + Sized,
Tel: Telemetry;
fn stop<C, Tel>(
&mut self,
_clock: &C,
_telemetry: &mut Tel,
) -> Result<(), NodeError>
where Tel: Telemetry;
// Provided methods
fn step<'graph, 'telemetry, 'clock, InQ, OutQ, InM, OutM, C, Tel>(
&mut self,
ctx: &mut StepContext<'graph, 'telemetry, 'clock, IN, OUT, InP, OutP, InQ, OutQ, InM, OutM, C, Tel>,
) -> Result<StepResult, NodeError>
where InQ: Edge,
OutQ: Edge,
InM: MemoryManager<InP>,
OutM: MemoryManager<OutP>,
C: PlatformClock + Sized,
Tel: Telemetry + Sized { ... }
fn step_batch<'graph, 'telemetry, 'clock, InQ, OutQ, InM, OutM, C, Tel>(
&mut self,
ctx: &mut StepContext<'graph, 'telemetry, 'clock, IN, OUT, InP, OutP, InQ, OutQ, InM, OutM, C, Tel>,
) -> Result<StepResult, NodeError>
where InQ: Edge,
OutQ: Edge,
InM: MemoryManager<InP>,
OutM: MemoryManager<OutP>,
C: PlatformClock + Sized,
Tel: Telemetry + Sized { ... }
}Expand description
The uniform node contract.
Nodes are parameterized by:
IN: number of input ports;OUT: number of output ports;InP: input payload type;OutP: output payload type.
Queue and manager types are introduced on each method via where clauses
rather than on the trait itself, keeping the trait payload-focused and
avoiding an explosion of type parameters on the impl.
Required Methods§
Sourcefn describe_capabilities(&self) -> NodeCapabilities
fn describe_capabilities(&self) -> NodeCapabilities
Return the node’s capability descriptor.
Sourcefn input_acceptance(&self) -> [PlacementAcceptance; IN]
fn input_acceptance(&self) -> [PlacementAcceptance; IN]
Return the node’s port placement acceptances (zero-copy compatibility).
Sourcefn output_acceptance(&self) -> [PlacementAcceptance; OUT]
fn output_acceptance(&self) -> [PlacementAcceptance; OUT]
Return the node’s output placement preferences (zero-copy compatibility).
Sourcefn policy(&self) -> NodePolicy
fn policy(&self) -> NodePolicy
Return the node’s policy bundle.
Sourcefn set_policy(&mut self, policy: NodePolicy)
fn set_policy(&mut self, policy: NodePolicy)
TEST ONLY method used to override batching policies for node contract tests.
Sourcefn initialize<C, Tel>(
&mut self,
clock: &C,
telemetry: &mut Tel,
) -> Result<(), NodeError>where
Tel: Telemetry,
fn initialize<C, Tel>(
&mut self,
clock: &C,
telemetry: &mut Tel,
) -> Result<(), NodeError>where
Tel: Telemetry,
Prepare internal state, acquire buffers, and register telemetry series.
Sourcefn start<C, Tel>(
&mut self,
_clock: &C,
_telemetry: &mut Tel,
) -> Result<(), NodeError>where
Tel: Telemetry,
fn start<C, Tel>(
&mut self,
_clock: &C,
_telemetry: &mut Tel,
) -> Result<(), NodeError>where
Tel: Telemetry,
Optional warm-up (e.g., compile kernels, prime pools). Default: no-op.
Sourcefn process_message<C>(
&mut self,
msg: &Message<InP>,
sys_clock: &C,
) -> Result<ProcessResult<OutP>, NodeError>where
C: PlatformClock + Sized,
fn process_message<C>(
&mut self,
msg: &Message<InP>,
sys_clock: &C,
) -> Result<ProcessResult<OutP>, NodeError>where
C: PlatformClock + Sized,
Per-message processing hook.
Receives a shared reference to the input message and returns a
ProcessResult indicating what output (if any) was produced.
The framework handles pushing outputs to edges; the node never
interacts with queues or managers directly.
Sourcefn on_watchdog_timeout<C, Tel>(
&mut self,
_clock: &C,
_telemetry: &mut Tel,
) -> Result<StepResult, NodeError>
fn on_watchdog_timeout<C, Tel>( &mut self, _clock: &C, _telemetry: &mut Tel, ) -> Result<StepResult, NodeError>
Handle watchdog timeouts by applying over-budget policy (degrade/default/skip).
Provided Methods§
Sourcefn step<'graph, 'telemetry, 'clock, InQ, OutQ, InM, OutM, C, Tel>(
&mut self,
ctx: &mut StepContext<'graph, 'telemetry, 'clock, IN, OUT, InP, OutP, InQ, OutQ, InM, OutM, C, Tel>,
) -> Result<StepResult, NodeError>where
InQ: Edge,
OutQ: Edge,
InM: MemoryManager<InP>,
OutM: MemoryManager<OutP>,
C: PlatformClock + Sized,
Tel: Telemetry + Sized,
fn step<'graph, 'telemetry, 'clock, InQ, OutQ, InM, OutM, C, Tel>(
&mut self,
ctx: &mut StepContext<'graph, 'telemetry, 'clock, IN, OUT, InP, OutP, InQ, OutQ, InM, OutM, C, Tel>,
) -> Result<StepResult, NodeError>where
InQ: Edge,
OutQ: Edge,
InM: MemoryManager<InP>,
OutM: MemoryManager<OutP>,
C: PlatformClock + Sized,
Tel: Telemetry + Sized,
Execute one cooperative step using the provided context.
The default implementation:
- Finds a ready input port via
input_edge_has_batch. - Pops a single message via
pop_and_process. - Delegates to
process_messageinside the callback.
Sourcefn step_batch<'graph, 'telemetry, 'clock, InQ, OutQ, InM, OutM, C, Tel>(
&mut self,
ctx: &mut StepContext<'graph, 'telemetry, 'clock, IN, OUT, InP, OutP, InQ, OutQ, InM, OutM, C, Tel>,
) -> Result<StepResult, NodeError>where
InQ: Edge,
OutQ: Edge,
InM: MemoryManager<InP>,
OutM: MemoryManager<OutP>,
C: PlatformClock + Sized,
Tel: Telemetry + Sized,
fn step_batch<'graph, 'telemetry, 'clock, InQ, OutQ, InM, OutM, C, Tel>(
&mut self,
ctx: &mut StepContext<'graph, 'telemetry, 'clock, IN, OUT, InP, OutP, InQ, OutQ, InM, OutM, C, Tel>,
) -> Result<StepResult, NodeError>where
InQ: Edge,
OutQ: Edge,
InM: MemoryManager<InP>,
OutM: MemoryManager<OutP>,
C: PlatformClock + Sized,
Tel: Telemetry + Sized,
Default batched-step implementation that honors all NodePolicy batching
variants while delegating actual consumption to the implementor’s
single-message process_message() method.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.