Guide API
Skip to main content

CustomValue

Trait CustomValue 

Source
pub trait CustomValue: Any + Debug {
    // Required method
    fn as_any_rc(self: Rc<Self>) -> Rc<dyn Any>;
}
Expand description

Marker for a user-invented payload carried in FieldValue::Custom.

Blanket-implemented for every 'static type that is Debug, so component authors implement nothing — they just put their type in a FieldValue::custom. Debug is required so a payload is inspectable (and so FieldValue keeps a derived Debug). The as_any_rc bridge lets the typed accessors downcast.

Required Methods§

Source

fn as_any_rc(self: Rc<Self>) -> Rc<dyn Any>

Upcast Rc<Self> to Rc<dyn Any> so FieldValue::as_custom / FieldValue::value_as can downcast.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T: Any + Debug> CustomValue for T