pub trait OperatorBinding: BindingBoundary {
// Required methods
fn register_projector(
&self,
f: Box<dyn Fn(HandleId) -> HandleId + Send + Sync>,
) -> FnId;
fn register_predicate(
&self,
f: Box<dyn Fn(HandleId) -> bool + Send + Sync>,
) -> FnId;
fn register_folder(
&self,
f: Box<dyn Fn(HandleId, HandleId) -> HandleId + Send + Sync>,
) -> FnId;
fn register_equals(
&self,
f: Box<dyn Fn(HandleId, HandleId) -> bool + Send + Sync>,
) -> FnId;
fn register_pairwise_packer(
&self,
f: Box<dyn Fn(HandleId, HandleId) -> HandleId + Send + Sync>,
) -> FnId;
fn register_packer(&self, f: PackerFn) -> FnId;
}Expand description
Closure-registration interface used by transform-operator factories.
Each method takes ownership of a user closure (boxed for type erasure)
and returns the FnId under which the binding registered it. The
operator factory then passes that FnId into graphrefly_core::OperatorOp
so the wave engine’s per-fire FFI calls can reach back through the
registry.
§Closure shape
All closures take and return HandleId (or bool for predicates) —
not T / R. Wrapping Fn(T) -> R into Fn(HandleId) -> HandleId is
a binding-side concern: deref incoming handles to T, run user code,
intern the output to a fresh HandleId. See D016 for rationale.
Implementations must be Send + Sync for the closure storage so the
binding can be shared across threads (matching BindingBoundary’s
Send + Sync super-bounds).
Required Methods§
Sourcefn register_projector(
&self,
f: Box<dyn Fn(HandleId) -> HandleId + Send + Sync>,
) -> FnId
fn register_projector( &self, f: Box<dyn Fn(HandleId) -> HandleId + Send + Sync>, ) -> FnId
Register a single-arg projector: Fn(T) -> R wrapped into
Fn(HandleId) -> HandleId. Used by super::transform::map.
The returned FnId is passed to
graphrefly_core::OperatorOp::Map.
Sourcefn register_predicate(
&self,
f: Box<dyn Fn(HandleId) -> bool + Send + Sync>,
) -> FnId
fn register_predicate( &self, f: Box<dyn Fn(HandleId) -> bool + Send + Sync>, ) -> FnId
Register a single-arg predicate: Fn(T) -> bool. Used by
super::transform::filter. The returned FnId is passed to
graphrefly_core::OperatorOp::Filter.
Sourcefn register_folder(
&self,
f: Box<dyn Fn(HandleId, HandleId) -> HandleId + Send + Sync>,
) -> FnId
fn register_folder( &self, f: Box<dyn Fn(HandleId, HandleId) -> HandleId + Send + Sync>, ) -> FnId
Register a left-fold reducer: Fn(R, T) -> R wrapped into
Fn(HandleId, HandleId) -> HandleId. Used by
super::transform::scan and super::transform::reduce. The
returned FnId is passed to graphrefly_core::OperatorOp::Scan
or graphrefly_core::OperatorOp::Reduce.
Sourcefn register_equals(
&self,
f: Box<dyn Fn(HandleId, HandleId) -> bool + Send + Sync>,
) -> FnId
fn register_equals( &self, f: Box<dyn Fn(HandleId, HandleId) -> bool + Send + Sync>, ) -> FnId
Register a custom-equals oracle: Fn(T, T) -> bool reused via
BindingBoundary::custom_equals. Used by
super::transform::distinct_until_changed. The returned
FnId is passed to
graphrefly_core::OperatorOp::DistinctUntilChanged.
Sourcefn register_pairwise_packer(
&self,
f: Box<dyn Fn(HandleId, HandleId) -> HandleId + Send + Sync>,
) -> FnId
fn register_pairwise_packer( &self, f: Box<dyn Fn(HandleId, HandleId) -> HandleId + Send + Sync>, ) -> FnId
Register a pairwise packer: Fn(prev: T, current: T) -> (T, T)
wrapped into Fn(HandleId, HandleId) -> HandleId (where the
returned handle resolves to the binding’s tuple representation).
Used by super::transform::pairwise. The returned FnId is
passed to graphrefly_core::OperatorOp::Pairwise.
Sourcefn register_packer(&self, f: PackerFn) -> FnId
fn register_packer(&self, f: PackerFn) -> FnId
Register a tuple packer: Fn(&[T]) -> Tuple wrapped into
Fn(&[HandleId]) -> HandleId (where the returned handle resolves
to the binding’s N-ary tuple representation).
Used by super::combine::combine and
super::combine::with_latest_from. The returned FnId is
passed to graphrefly_core::OperatorOp::Combine or
graphrefly_core::OperatorOp::WithLatestFrom.