Trait AnyCodec

Source
pub trait AnyCodec {
    // Provided methods
    fn decode_any_vec<C>(data: Vec<u8>) -> Result<C, DecodingError>
       where C: TryFrom<Any>,
             <C as TryFrom<Any>>::Error: Display { ... }
    fn encode_to_any_vec<C>(value: C) -> Vec<u8> 
       where C: Into<Any> { ... }
}
Expand description

AnyCodec is a convenient trait that provides a generic way to encode and decode domain types through the Any type.

Provided Methods§

Source

fn decode_any_vec<C>(data: Vec<u8>) -> Result<C, DecodingError>
where C: TryFrom<Any>, <C as TryFrom<Any>>::Error: Display,

Source

fn encode_to_any_vec<C>(value: C) -> Vec<u8>
where C: Into<Any>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> AnyCodec for T
where T: TryFrom<Any> + Into<Any>,