pub struct SendEdge<S>{
pub selector: Arc<dyn Fn(&S) -> Vec<(String, S)> + Send + Sync>,
pub merger: Arc<dyn Fn(S, S) -> S + Send + Sync>,
pub join: String,
/* private fields */
}Expand description
Parallel fan-out edge.
After the source node completes, the runtime evaluates selector
to obtain branches, runs each target node in parallel, folds the
post-branch states via the state’s
StateMerge::merge impl, then jumps
to join.
The target list is stored as both an ordered Vec (preserving
the declaration order the operator passed to
crate::StateGraph::add_send_edges) and a HashSet for
O(1) membership checks at dispatch time. The split lets compile-
error messages and Debug output reflect the operator’s source
order — flaky test output and grep-unfriendly logs would
otherwise leak into every dashboard.
Fields§
§selector: Arc<dyn Fn(&S) -> Vec<(String, S)> + Send + Sync>Branch-set producer. Must return (target, branch_state)
pairs whose target is a member of targets.
merger: Arc<dyn Fn(S, S) -> S + Send + Sync>Per-branch merger applied during the post-fan-out fold —
see SendMerger.
join: StringNode that receives the merged state, or crate::END for
terminal fan-outs that complete after the merge.
Implementations§
Source§impl<S> SendEdge<S>
impl<S> SendEdge<S>
Sourcepub fn new(
targets: impl IntoIterator<Item = String>,
selector: Arc<dyn Fn(&S) -> Vec<(String, S)> + Send + Sync>,
merger: Arc<dyn Fn(S, S) -> S + Send + Sync>,
join: String,
) -> SendEdge<S>
pub fn new( targets: impl IntoIterator<Item = String>, selector: Arc<dyn Fn(&S) -> Vec<(String, S)> + Send + Sync>, merger: Arc<dyn Fn(S, S) -> S + Send + Sync>, join: String, ) -> SendEdge<S>
Construct a SendEdge from its parts. The target list is
deduplicated while preserving first-occurrence order — a
repeated declaration is a no-op (the deduped name still
dispatches once).
Sourcepub fn targets(&self) -> &[String]
pub fn targets(&self) -> &[String]
Borrow the declaration-ordered target list. Order matches
the names the operator passed to
crate::StateGraph::add_send_edges.
Sourcepub fn has_target(&self, name: &str) -> bool
pub fn has_target(&self, name: &str) -> bool
True when name is a declared dispatch target. O(1) via
the internal HashSet.
Auto Trait Implementations§
impl<S> Freeze for SendEdge<S>
impl<S> !RefUnwindSafe for SendEdge<S>
impl<S> Send for SendEdge<S>
impl<S> Sync for SendEdge<S>
impl<S> Unpin for SendEdge<S>
impl<S> UnsafeUnpin for SendEdge<S>
impl<S> !UnwindSafe for SendEdge<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request