pub struct SourceNode<S, OutP, const OUT: usize>{ /* 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>
impl<S, OutP, const OUT: usize> SourceNode<S, OutP, OUT>
Sourcepub const fn new(src: S, policy: NodePolicy) -> Self
pub const fn new(src: S, policy: NodePolicy) -> Self
Construct a SourceNode from a source and a static policy bundle.
Sourcepub fn source_ref(&self) -> &S
pub fn source_ref(&self) -> &S
Borrow the underlying source immutably.
Sourcepub fn source_mut(&mut self) -> &mut S
pub fn source_mut(&mut self) -> &mut S
Borrow the underlying source mutably.
Sourcepub fn ingress_edge_has_batch(&self) -> bool
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>
Allow graphs to accept any Source and convert implicitly.
impl<S, OutP, const OUT: usize> From<S> for SourceNode<S, OutP, OUT>
Allow graphs to accept any Source and convert implicitly.
Source§impl<S, OutP, const OUT: usize> Node<0, OUT, (), OutP> for SourceNode<S, OutP, OUT>
impl<S, OutP, const OUT: usize> Node<0, OUT, (), OutP> for SourceNode<S, OutP, OUT>
Source§fn 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.
Source§fn describe_capabilities(&self) -> NodeCapabilities
fn describe_capabilities(&self) -> NodeCapabilities
Source§fn input_acceptance(&self) -> [PlacementAcceptance; 0]
fn input_acceptance(&self) -> [PlacementAcceptance; 0]
Source§fn output_acceptance(&self) -> [PlacementAcceptance; OUT]
fn output_acceptance(&self) -> [PlacementAcceptance; OUT]
Source§fn policy(&self) -> NodePolicy
fn policy(&self) -> NodePolicy
Source§fn initialize<C, T>(&mut self, _c: &C, _t: &mut T) -> Result<(), NodeError>where
T: Telemetry,
fn initialize<C, T>(&mut self, _c: &C, _t: &mut T) -> Result<(), NodeError>where
T: Telemetry,
Source§fn start<C, T>(&mut self, _c: &C, _t: &mut T) -> Result<(), NodeError>where
T: Telemetry,
fn start<C, T>(&mut self, _c: &C, _t: &mut T) -> Result<(), NodeError>where
T: Telemetry,
Source§fn process_message<C>(
&mut self,
_msg: &Message<()>,
_sys_clock: &C,
) -> Result<ProcessResult<OutP>, NodeError>where
C: PlatformClock + Sized,
fn process_message<C>(
&mut self,
_msg: &Message<()>,
_sys_clock: &C,
) -> Result<ProcessResult<OutP>, NodeError>where
C: PlatformClock + Sized,
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,
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,
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,
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,
process_message() method.