Skip to main content

CodecExt

Trait CodecExt 

Source
pub trait CodecExt: Codec {
    // Provided methods
    fn serialise<T>(&self, value: &T) -> Result<ValueBytes>
       where T: Serialize { ... }
    fn deserialise<T>(&self, bytes: &ValueBytes) -> Result<T>
       where T: DeserializeOwned { ... }
}
Expand description

Typed codec helpers.

Provided Methods§

Source

fn serialise<T>(&self, value: &T) -> Result<ValueBytes>
where T: Serialize,

Serialises a typed value into bytes.

Source

fn deserialise<T>(&self, bytes: &ValueBytes) -> Result<T>

Deserialises bytes into a typed value.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T> CodecExt for T
where T: Codec + ?Sized,