pub trait ReflectedValue:
Send
+ Sync
+ Debug {
// Required methods
fn type_name(&self) -> &str;
fn display(&self) -> String;
fn as_any(&self) -> &dyn Any;
fn clone_reflected(&self) -> Box<dyn ReflectedValue>;
// Provided methods
fn to_json_value(&self) -> Value { ... }
fn try_as_str(&self) -> Option<String> { ... }
fn try_as_u64(&self) -> Option<u64> { ... }
fn try_as_f64(&self) -> Option<f64> { ... }
fn try_as_bytes(&self) -> Option<&[u8]> { ... }
}Expand description
Trait for adapter-contributed value types.
Any type that flows through the Polydat Kernel as Value::Ext must
implement this. It provides standard access patterns that work
across adapter boundaries — stdout can display it, HTTP can
serialize it, model adapter can capture it — without needing
the concrete type.
The producing adapter can downcast via as_any() when it needs
native protocol access (e.g., CQL binding a uuid::Uuid).
Required Methods§
Sourcefn display(&self) -> String
fn display(&self) -> String
Human-readable string representation. Used by stdout adapter, logging, and diagnostics.
Sourcefn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Downcast to the concrete type. Only works when the consuming code has the concrete type in scope (same crate or shared dep).
Sourcefn clone_reflected(&self) -> Box<dyn ReflectedValue>
fn clone_reflected(&self) -> Box<dyn ReflectedValue>
Clone into a new boxed trait object.
Provided Methods§
Sourcefn to_json_value(&self) -> Value
fn to_json_value(&self) -> Value
JSON representation for serialization and HTTP bodies.
Sourcefn try_as_str(&self) -> Option<String>
fn try_as_str(&self) -> Option<String>
Try to represent as a string. Many types have a canonical string form (UUIDs, timestamps, IP addresses).
Sourcefn try_as_u64(&self) -> Option<u64>
fn try_as_u64(&self) -> Option<u64>
Try to represent as u64.
Sourcefn try_as_f64(&self) -> Option<f64>
fn try_as_f64(&self) -> Option<f64>
Try to represent as f64.
Sourcefn try_as_bytes(&self) -> Option<&[u8]>
fn try_as_bytes(&self) -> Option<&[u8]>
Try to represent as bytes.
Trait Implementations§
Source§impl Clone for Box<dyn ReflectedValue>
impl Clone for Box<dyn ReflectedValue>
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§const JIT: Option<JitType> = None
const JIT: Option<JitType> = None
Some(_) means the type
rides the Phase-2 u64 buffer; None means typed-eval
only.Source§const RESOLVER: Option<DefaultResolver> = None
const RESOLVER: Option<DefaultResolver> = None
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.Source§const WIRE_COST: WireCost = crate::ast::WireCost::Data
const WIRE_COST: WireCost = crate::ast::WireCost::Data
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.Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".