Skip to main content

ReflectedValue

Trait ReflectedValue 

Source
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§

Source

fn type_name(&self) -> &str

Type name for diagnostics and describe output.

Source

fn display(&self) -> String

Human-readable string representation. Used by stdout adapter, logging, and diagnostics.

Source

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).

Source

fn clone_reflected(&self) -> Box<dyn ReflectedValue>

Clone into a new boxed trait object.

Provided Methods§

Source

fn to_json_value(&self) -> Value

JSON representation for serialization and HTTP bodies.

Source

fn try_as_str(&self) -> Option<String>

Try to represent as a string. Many types have a canonical string form (UUIDs, timestamps, IP addresses).

Source

fn try_as_u64(&self) -> Option<u64>

Try to represent as u64.

Source

fn try_as_f64(&self) -> Option<f64>

Try to represent as f64.

Source

fn try_as_bytes(&self) -> Option<&[u8]>

Try to represent as bytes.

Trait Implementations§

Source§

impl Clone for Box<dyn ReflectedValue>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
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.

Source§

const PORT: PortType = PortType::Ext

Static port type for the DSL type-checker.
Source§

const JIT: Option<JitType> = None

JIT carrier classification. Some(_) means the type rides the Phase-2 u64 buffer; None means typed-eval only.
Source§

fn extract(v: &Value) -> Self

Pull a typed value out of a Value wire.
Source§

fn inject(self) -> Value

Push a typed value back into the Value outputs stream.
Source§

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.
Source§

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§