Skip to main content

GraphNodeContextBuilder

Trait GraphNodeContextBuilder 

Source
pub trait GraphNodeContextBuilder<const I: usize, const IN: usize, const OUT: usize>: GraphNodeTypes<I, IN, OUT> {
    // Required methods
    fn make_step_context<'graph, 'telemetry, 'clock, C, T>(
        &'graph mut self,
        clock: &'clock C,
        telemetry: &'telemetry mut T,
    ) -> StepContext<'graph, 'telemetry, 'clock, IN, OUT, <Self as GraphNodeTypes<I, IN, OUT>>::InP, <Self as GraphNodeTypes<I, IN, OUT>>::OutP, <Self as GraphNodeTypes<I, IN, OUT>>::InQ, <Self as GraphNodeTypes<I, IN, OUT>>::OutQ, <Self as GraphNodeTypes<I, IN, OUT>>::InM, <Self as GraphNodeTypes<I, IN, OUT>>::OutM, C, T>
       where EdgePolicy: Copy,
             C: PlatformClock + Sized,
             T: Telemetry + Sized;
    fn with_node_and_step_context<'telemetry, 'clock, C, T, R, E>(
        &mut self,
        clock: &'clock C,
        telemetry: &'telemetry mut T,
        f: impl FnOnce(&mut <Self as GraphNodeAccess<I>>::Node, &mut StepContext<'_, 'telemetry, 'clock, IN, OUT, <Self as GraphNodeTypes<I, IN, OUT>>::InP, <Self as GraphNodeTypes<I, IN, OUT>>::OutP, <Self as GraphNodeTypes<I, IN, OUT>>::InQ, <Self as GraphNodeTypes<I, IN, OUT>>::OutQ, <Self as GraphNodeTypes<I, IN, OUT>>::InM, <Self as GraphNodeTypes<I, IN, OUT>>::OutM, C, T>) -> Result<R, E>,
    ) -> Result<R, E>
       where Self: GraphNodeAccess<I>,
             EdgePolicy: Copy,
             C: PlatformClock + Sized,
             T: Telemetry + Sized;
}
Expand description

Builder for per-node execution contexts.

This trait is implemented by the graph-building macro. It allows the runtime to create a StepContext for a given node using compile-time wiring of its ports, queues, and policies.

§Type Parameters

  • I: Compile-time index of the node within the graph.
  • IN: Number of input ports for the node.
  • OUT: Number of output ports for the node.

Required Methods§

Source

fn make_step_context<'graph, 'telemetry, 'clock, C, T>( &'graph mut self, clock: &'clock C, telemetry: &'telemetry mut T, ) -> StepContext<'graph, 'telemetry, 'clock, IN, OUT, <Self as GraphNodeTypes<I, IN, OUT>>::InP, <Self as GraphNodeTypes<I, IN, OUT>>::OutP, <Self as GraphNodeTypes<I, IN, OUT>>::InQ, <Self as GraphNodeTypes<I, IN, OUT>>::OutQ, <Self as GraphNodeTypes<I, IN, OUT>>::InM, <Self as GraphNodeTypes<I, IN, OUT>>::OutM, C, T>

Construct a StepContext for node I.

§Parameters
  • clock: Reference to the runtime clock abstraction.
  • telemetry: Mutable reference to the telemetry collector.
§Returns

A fully wired StepContext for the node, ready for execution.

Source

fn with_node_and_step_context<'telemetry, 'clock, C, T, R, E>( &mut self, clock: &'clock C, telemetry: &'telemetry mut T, f: impl FnOnce(&mut <Self as GraphNodeAccess<I>>::Node, &mut StepContext<'_, 'telemetry, 'clock, IN, OUT, <Self as GraphNodeTypes<I, IN, OUT>>::InP, <Self as GraphNodeTypes<I, IN, OUT>>::OutP, <Self as GraphNodeTypes<I, IN, OUT>>::InQ, <Self as GraphNodeTypes<I, IN, OUT>>::OutQ, <Self as GraphNodeTypes<I, IN, OUT>>::InM, <Self as GraphNodeTypes<I, IN, OUT>>::OutM, C, T>) -> Result<R, E>, ) -> Result<R, E>

Borrowed handoff: in one &mut self borrow, lend both &mut node(I) and a fully wired StepContext to a closure. This avoids overlapping &mut borrows escaping the call.

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.

Implementors§

Source§

impl<SrcClk: PlatformClock + Send + 'static> GraphNodeContextBuilder<0, 0, 1> for TestPipelineStd<SrcClk>
where Self: GraphNodeAccess<0, Node = NodeLink<SourceNode<TestCounterSourceTensor<SrcClk, 32>, TestTensor, 1>, 0, 1, (), TestTensor>>,

Source§

impl<SrcClk: PlatformClock + Send + 'static> GraphNodeContextBuilder<1, 1, 1> for TestPipelineStd<SrcClk>
where Self: GraphNodeAccess<1, Node = NodeLink<TestIdentityModelNodeTensor<TEST_MAX_BATCH>, 1, 1, TestTensor, TestTensor>>,

Source§

impl<SrcClk: PlatformClock + Send + 'static> GraphNodeContextBuilder<2, 1, 0> for TestPipelineStd<SrcClk>

Source§

impl<SrcClk: PlatformClock> GraphNodeContextBuilder<0, 0, 1> for TestPipeline<SrcClk>
where Self: GraphNodeAccess<0, Node = NodeLink<SourceNode<TestCounterSourceTensor<SrcClk, 32>, TestTensor, 1>, 0, 1, (), TestTensor>>,

Source§

impl<SrcClk: PlatformClock> GraphNodeContextBuilder<1, 1, 1> for TestPipeline<SrcClk>
where Self: GraphNodeAccess<1, Node = NodeLink<TestIdentityModelNodeTensor<TEST_MAX_BATCH>, 1, 1, TestTensor, TestTensor>>,

Source§

impl<SrcClk: PlatformClock> GraphNodeContextBuilder<2, 1, 0> for TestPipeline<SrcClk>