Skip to main content

NodeLink

Struct NodeLink 

Source
#[non_exhaustive]
pub struct NodeLink<N, const IN: usize, const OUT: usize, InP, OutP>
where InP: Payload, OutP: Payload, N: Node<IN, OUT, InP, OutP>,
{ /* private fields */ }
Expand description

A lightweight descriptor that links to a concrete node instance and records its static topology and policy metadata.

Unlike a pure descriptor, NodeLink owns the concrete node instance (N) and records its identity, kind, port counts, policy, and optional name for graph construction, scheduling, diagnostics, and tooling. It exposes &N and &mut N accessors so runtimes can operate on the live node.

§Type Parameters

  • 'a: Lifetime of the borrowed node reference. The descriptor cannot outlive the node.
  • N: Concrete node type implementing Node<IN, OUT, InP, OutP>.
  • IN: Compile-time number of input ports for the node.
  • OUT: Compile-time number of output ports for the node.
  • InP: Input payload type (must implement Payload).
  • OutP: Output payload type (must implement Payload).

§Invariants

Callers should ensure in_ports == IN as u16 and out_ports == OUT as u16 so the stored counts are consistent with the node’s const-generic port arity.

Implementations§

Source§

impl<N, const IN: usize, const OUT: usize, InP, OutP> NodeLink<N, IN, OUT, InP, OutP>
where InP: Payload, OutP: Payload, N: Node<IN, OUT, InP, OutP>,

Source

pub fn new(node: N, id: NodeIndex, name: Option<&'static str>) -> Self

Construct a new NodeLink that borrows the given node and records its metadata.

§Parameters
  • node: Borrowed reference to the concrete node instance.
  • id: Unique identifier of the node in the graph.
  • name: Optional static name for diagnostics or tooling.
Source

pub fn node(&self) -> &N

Get a reference to the inner node.

Source

pub fn node_mut(&mut self) -> &mut N

Get a mutable reference to the inner node.

Source

pub fn id(&self) -> NodeIndex

Get the unique identifier of this node.

Source

pub fn input_port_ids(&self) -> [PortId; IN]

Returns the input port ids for the node.

Source

pub fn output_port_ids(&self) -> [PortId; OUT]

Returns the input port ids for the node.

Source

pub fn policy(&self) -> NodePolicy

Return the node’s policy bundle.

Source

pub fn name(&self) -> Option<&'static str>

Get the optional static name of this node.

Source

pub fn descriptor(&self) -> NodeDescriptor

Return the NodeDescriptor for this NodeLink.

Trait Implementations§

Source§

impl<N, const IN: usize, const OUT: usize, InP, OutP> Clone for NodeLink<N, IN, OUT, InP, OutP>
where InP: Payload + Clone, OutP: Payload + Clone, N: Node<IN, OUT, InP, OutP> + Clone,

Source§

fn clone(&self) -> NodeLink<N, IN, OUT, InP, OutP>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<N, const IN: usize, const OUT: usize, InP, OutP> Debug for NodeLink<N, IN, OUT, InP, OutP>
where InP: Payload + Debug, OutP: Payload + Debug, N: Node<IN, OUT, InP, OutP> + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<N, const IN: usize, const OUT: usize, InP, OutP> Node<IN, OUT, InP, OutP> for NodeLink<N, IN, OUT, InP, OutP>
where InP: Payload, OutP: Payload, N: Node<IN, OUT, InP, OutP>,

Source§

fn set_policy(&mut self, policy: NodePolicy)

TEST ONLY method used to override batching policis for node contract tests.

Source§

fn describe_capabilities(&self) -> NodeCapabilities

Return the node’s capability descriptor.
Source§

fn input_acceptance(&self) -> [PlacementAcceptance; IN]

Return the node’s port placement acceptances (zero-copy compatibility).
Source§

fn output_acceptance(&self) -> [PlacementAcceptance; OUT]

Return the node’s output placement preferences (zero-copy compatibility).
Source§

fn policy(&self) -> NodePolicy

Return the node’s policy bundle.
Source§

fn node_kind(&self) -> NodeKind

Return the type of node (Model, processing, source, sink).
Source§

fn initialize<C, T>( &mut self, clock: &C, telemetry: &mut T, ) -> Result<(), NodeError>
where T: Telemetry,

Prepare internal state, acquire buffers, and register telemetry series.
Source§

fn start<C, T>(&mut self, clock: &C, telemetry: &mut T) -> Result<(), NodeError>
where T: Telemetry,

Optional warm-up (e.g., compile kernels, prime pools). Default: no-op.
Source§

fn process_message<C>( &mut self, msg: &Message<InP>, sys_clock: &C, ) -> Result<ProcessResult<OutP>, NodeError>
where C: PlatformClock + Sized,

Per-message processing hook. Read more
Source§

fn step<'graph, 'telemetry, 'clock, InQ, OutQ, InM, OutM, C, T>( &mut self, ctx: &mut StepContext<'graph, 'telemetry, 'clock, IN, OUT, InP, OutP, InQ, OutQ, InM, OutM, C, T>, ) -> Result<StepResult, NodeError>
where InQ: Edge, OutQ: Edge, InM: MemoryManager<InP>, OutM: MemoryManager<OutP>, C: PlatformClock + Sized, T: Telemetry + Sized,

Execute one cooperative step using the provided context. Read more
Source§

fn step_batch<'graph, 'telemetry, 'clock, InQ, OutQ, InM, OutM, C, T>( &mut self, ctx: &mut StepContext<'graph, 'telemetry, 'clock, IN, OUT, InP, OutP, InQ, OutQ, InM, OutM, C, T>, ) -> Result<StepResult, NodeError>
where InQ: Edge, OutQ: Edge, InM: MemoryManager<InP>, OutM: MemoryManager<OutP>, C: PlatformClock + Sized, T: 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.
Source§

fn on_watchdog_timeout<C, T>( &mut self, clock: &C, telemetry: &mut T, ) -> Result<StepResult, NodeError>
where C: PlatformClock + Sized, T: Telemetry,

Handle watchdog timeouts by applying over-budget policy (degrade/default/skip).
Source§

fn stop<C, T>(&mut self, clock: &C, telemetry: &mut T) -> Result<(), NodeError>
where T: Telemetry,

Flush and release resources, if any. Default: no-op.

Auto Trait Implementations§

§

impl<N, const IN: usize, const OUT: usize, InP, OutP> Freeze for NodeLink<N, IN, OUT, InP, OutP>
where N: Freeze,

§

impl<N, const IN: usize, const OUT: usize, InP, OutP> RefUnwindSafe for NodeLink<N, IN, OUT, InP, OutP>

§

impl<N, const IN: usize, const OUT: usize, InP, OutP> Send for NodeLink<N, IN, OUT, InP, OutP>
where N: Send, InP: Send, OutP: Send,

§

impl<N, const IN: usize, const OUT: usize, InP, OutP> Sync for NodeLink<N, IN, OUT, InP, OutP>
where N: Sync, InP: Sync, OutP: Sync,

§

impl<N, const IN: usize, const OUT: usize, InP, OutP> Unpin for NodeLink<N, IN, OUT, InP, OutP>
where N: Unpin, InP: Unpin, OutP: Unpin,

§

impl<N, const IN: usize, const OUT: usize, InP, OutP> UnsafeUnpin for NodeLink<N, IN, OUT, InP, OutP>
where N: UnsafeUnpin,

§

impl<N, const IN: usize, const OUT: usize, InP, OutP> UnwindSafe for NodeLink<N, IN, OUT, InP, OutP>
where N: UnwindSafe, InP: UnwindSafe, OutP: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.