Skip to main content

ErasedWireValue

Trait ErasedWireValue 

Source
pub trait ErasedWireValue:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn type_id(&self) -> WireTypeId;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Object-safe view over WireValue.

Codec implementations work in terms of &dyn ErasedWireValue so they can be invoked through &dyn WireCodec without becoming generic. The blanket impl below makes the conversion implicit at call sites: any &T where T: WireValue coerces to &dyn ErasedWireValue.

Required Methods§

Source

fn type_id(&self) -> WireTypeId

The wire type id of the underlying concrete value.

Source

fn as_any(&self) -> &dyn Any

Provide an Any view so codec impls can downcast to the concrete type they registered.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<T> ErasedWireValue for T
where T: WireValue,