Skip to main content

SlotValue

Trait SlotValue 

Source
pub trait SlotValue:
    Any
    + Send
    + Sync {
    // Required methods
    fn as_any(&self) -> &(dyn Any + 'static);
    fn into_any_boxed(self: Box<Self>) -> Box<dyn Any + Sync + Send>;
    fn clone_boxed(&self) -> Box<dyn SlotValue>;
    fn to_wire_bytes(&self) -> Result<Vec<u8>, SlotValueError>;
    fn type_hash(&self) -> u64;

    // Provided methods
    fn runtime_type(&self) -> &'static TypeNode { ... }
    fn charged_bytes(&self) -> usize { ... }
}
Expand description

Universal slot value. Slot-table values, op outputs, and dispatch_atomic inputs are all Box<dyn SlotValue> / &dyn SlotValue. Local forwarding uses clone_boxed; wire + snapshot paths use to_wire_bytes.

Required Methods§

Source

fn as_any(&self) -> &(dyn Any + 'static)

Downcast surface — recover the concrete type.

Source

fn into_any_boxed(self: Box<Self>) -> Box<dyn Any + Sync + Send>

Repackage Box<dyn SlotValue> as Box<dyn Any> for Box::downcast. Required because the SlotValue and Any vtables are distinct even though SlotValue: Any.

Source

fn clone_boxed(&self) -> Box<dyn SlotValue>

Polymorphic clone preserving the concrete type.

Source

fn to_wire_bytes(&self) -> Result<Vec<u8>, SlotValueError>

Wire-boundary encode (bincode + serde). Local forwarding uses clone_boxed instead.

Source

fn type_hash(&self) -> u64

Stable cross-Node type discriminator. FNV-1a of std::any::type_name::<T>(); receiver decodes only on a matching hash.

Provided Methods§

Source

fn runtime_type(&self) -> &'static TypeNode

Runtime TypeNode for this value. Returns the leaf registered via [register_type_node!] or TYPE_ANY. Consulted at wire boundaries + TypeSolver seeding; the atomic-dispatch hot path uses compile-time-stamped closures.

Source

fn charged_bytes(&self) -> usize

Bytes the carrier owes against NodeConfig::ingress_byte_budget. Slot-table eviction calls this to release the charge. Default 0 — only ingress-derived carriers register a non-zero resolver via [register_charged_bytes!].

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl SlotValue for BackendTensorCarrier

Source§

impl<T> SlotValue for T

The only SlotValue impl path. Manual impls are not supported — “derive serde + Clone” gets you a wire-eligible carrier.