Skip to main content

SourceNode

Struct SourceNode 

Source
pub struct SourceNode<S, OutP, const OUT: usize>
where S: Source<OutP, OUT>, OutP: Payload,
{ /* private fields */ }
Expand description

A thin adapter that exposes a Source as a Node<0, OUT, (), OutP>.

This allows sources to participate in graphs and be scheduled by runtimes without any special-case code. The node owns the source and forwards the node lifecycle calls as needed.

Implementations§

Source§

impl<S, OutP, const OUT: usize> SourceNode<S, OutP, OUT>
where S: Source<OutP, OUT>, OutP: Payload,

Source

pub const fn new(src: S, policy: NodePolicy) -> Self

Construct a SourceNode from a source and a static policy bundle.

Source

pub fn source_ref(&self) -> &S

Borrow the underlying source immutably.

Source

pub fn source_mut(&mut self) -> &mut S

Borrow the underlying source mutably.

Source

pub fn ingress_edge_has_batch(&self) -> bool

Return true if the ingress (external) edge for this source can produce a batch now under the given batching policy.

This mirrors StepContext::input_edge_has_batch semantics and the step_batch checks: it is observational (no side effects) and conservative on header-peek failures.

Trait Implementations§

Source§

impl<S, OutP, const OUT: usize> From<S> for SourceNode<S, OutP, OUT>
where S: Source<OutP, OUT>, OutP: Payload,

Allow graphs to accept any Source and convert implicitly.

Source§

fn from(src: S) -> Self

Converts to this type from the input type.
Source§

impl<S, OutP, const OUT: usize> Node<0, OUT, (), OutP> for SourceNode<S, OutP, OUT>
where S: Source<OutP, OUT>, OutP: Payload + Copy,

Source§

fn set_policy(&mut self, policy: NodePolicy)

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

Source§

fn describe_capabilities(&self) -> NodeCapabilities

Return the node’s capability descriptor.
Source§

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

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, _c: &C, _t: &mut T) -> Result<(), NodeError>
where T: Telemetry,

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

fn start<C, T>(&mut self, _c: &C, _t: &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<()>, _sys_clock: &C, ) -> Result<ProcessResult<OutP>, NodeError>
where C: PlatformClock + Sized,

Per-message processing hook. Read more
Source§

fn step<'g, 't, 'ck, InQ, OutQ, InM, OutM, C, Tel>( &mut self, ctx: &mut StepContext<'g, 't, 'ck, 0, OUT, (), OutP, InQ, OutQ, InM, OutM, C, Tel>, ) -> Result<StepResult, NodeError>
where InQ: Edge, OutQ: Edge, InM: MemoryManager<()>, OutM: MemoryManager<OutP>, C: PlatformClock + Sized, Tel: Telemetry + Sized,

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

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

fn on_watchdog_timeout<C, Tel>( &mut self, _c: &C, _t: &mut Tel, ) -> Result<StepResult, NodeError>
where Tel: Telemetry,

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

fn stop<C, Tel>(&mut self, _c: &C, _t: &mut Tel) -> Result<(), NodeError>
where Tel: Telemetry,

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

Auto Trait Implementations§

§

impl<S, OutP, const OUT: usize> Freeze for SourceNode<S, OutP, OUT>
where S: Freeze,

§

impl<S, OutP, const OUT: usize> RefUnwindSafe for SourceNode<S, OutP, OUT>
where S: RefUnwindSafe, OutP: RefUnwindSafe,

§

impl<S, OutP, const OUT: usize> Send for SourceNode<S, OutP, OUT>
where S: Send, OutP: Send,

§

impl<S, OutP, const OUT: usize> Sync for SourceNode<S, OutP, OUT>
where S: Sync, OutP: Sync,

§

impl<S, OutP, const OUT: usize> Unpin for SourceNode<S, OutP, OUT>
where S: Unpin, OutP: Unpin,

§

impl<S, OutP, const OUT: usize> UnsafeUnpin for SourceNode<S, OutP, OUT>
where S: UnsafeUnpin,

§

impl<S, OutP, const OUT: usize> UnwindSafe for SourceNode<S, OutP, OUT>
where S: 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> 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, 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.