pub trait Wire: Sized + 'static {
const PORT: PortType;
const JIT: Option<JitType>;
const RESOLVER: Option<DefaultResolver> = None;
const WIRE_COST: WireCost = crate::ast::WireCost::Data;
// Required methods
fn extract(v: &Value) -> Self;
fn inject(self) -> Value;
}Expand description
Rust-type ↔ Value bridge.
Every owned Rust type the macro accepts in a wire position
implements this trait. PORT is the static PortType the
DSL type-checker uses to route a wire to this slot; JIT
tags the type as ridable on the Phase-2 u64 buffer (or
None if it stays on the Phase-1 typed-eval path).
Borrow shapes (&str, &[u8], &[T],
&serde_json::Value) and polymorphic Value-typed wires
are NOT covered here — the macro recognises them
syntactically and emits direct match-on-Value extraction
at the eval call site. This keeps the trait surface free of
lifetime parameters.
extract panics on type mismatch — the DSL type-checker is
responsible for routing well-typed Values to each slot
before eval runs. A panic here is a “type-checker was
lied to” bug, not a normal path.
Required Associated Constants§
Provided Associated Constants§
Sourceconst RESOLVER: Option<DefaultResolver> = None
const RESOLVER: Option<DefaultResolver> = None
SRD-53 §“Source-string call-site sugar” — auto-resolver
for Str-typed upstream wires feeding this slot. None
(the default) disables auto-promotion; the workload must
supply the wire’s actual port type directly. Set via the
Resolved<R, T> marker wrapper.
Sourceconst WIRE_COST: WireCost = crate::ast::WireCost::Data
const WIRE_COST: WireCost = crate::ast::WireCost::Data
SRD-15 §“WireCost::Config” — cost class for this wire.
Defaults to WireCost::Data (cheap per-cycle input).
Set to WireCost::Config via the Config<T> marker
wrapper to signal that the wire is rarely-changing and
the compiler should warn on cycle-time binding.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Wire for Arc<dyn Any + Send + Sync>
Arc<dyn Any + Send + Sync> — opaque Handle wire. The body
receives the runtime-typed handle directly; downcast is the
operator’s responsibility. Use Resolved<R, T> when the
node wants a typed Handle with SRD-53 source-string
auto-promotion sugar; use this raw shape when the body
needs to handle multiple inner types via runtime dispatch.
impl Wire for Arc<dyn Any + Send + Sync>
Arc<dyn Any + Send + Sync> — opaque Handle wire. The body
receives the runtime-typed handle directly; downcast is the
operator’s responsibility. Use Resolved<R, T> when the
node wants a typed Handle with SRD-53 source-string
auto-promotion sugar; use this raw shape when the body
needs to handle multiple inner types via runtime dispatch.
Source§impl Wire for Arc<str>
Arc<str> — zero-copy shared string handle. Reading
extracts the existing Arc<str> from Value::Str (refcount
bump only); injecting wraps directly. Nodes whose hot path
emits the same string per cycle (lookup table outputs,
fixed-value selectors) should use this instead of String
to avoid the per-cycle to_string() allocation.
impl Wire for Arc<str>
Arc<str> — zero-copy shared string handle. Reading
extracts the existing Arc<str> from Value::Str (refcount
bump only); injecting wraps directly. Nodes whose hot path
emits the same string per cycle (lookup table outputs,
fixed-value selectors) should use this instead of String
to avoid the per-cycle to_string() allocation.
Source§impl Wire for Box<dyn ReflectedValue>
Box<dyn ReflectedValue> — Ext (adapter-typed) wire with
dynamic downcast left to the body. Use Ext<T> when the
inner type is known at codegen; use this when a node needs
to dispatch on the runtime ReflectedValue::type_name.
impl Wire for Box<dyn ReflectedValue>
Box<dyn ReflectedValue> — Ext (adapter-typed) wire with
dynamic downcast left to the body. Use Ext<T> when the
inner type is known at codegen; use this when a node needs
to dispatch on the runtime ReflectedValue::type_name.
Source§impl<T: Wire> Wire for Option<T>
None-aware wire combinator. Macro auto-emits
accepts_none_inputs() -> true when any arg is Option<_>.
impl<T: Wire> Wire for Option<T>
None-aware wire combinator. Macro auto-emits
accepts_none_inputs() -> true when any arg is Option<_>.