Skip to main content

Deserialiser

Trait Deserialiser 

Source
pub trait Deserialiser<T>: Send {
    const SER_ID: u64;

    // Required method
    fn deserialise(buf: &mut dyn Buf) -> Result<T, SerError>;
}
Expand description

A trait to deserialise values of type T from buffers

There should be one deserialiser with the same serialisation id for each Serialiser or Serialisable implementation. It is recommended to implement both on the same type.

Required Associated Constants§

Source

const SER_ID: u64

The serialisation id for which this deserialiser is to be invoked

Required Methods§

Source

fn deserialise(buf: &mut dyn Buf) -> Result<T, SerError>

Try to deserialise a T from the given buf

Returns a SerError if unsuccessful.

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.

Implementations on Foreign Types§

Source§

impl Deserialiser<!> for !

Source§

const SER_ID: u64 = serialisation_ids::UNKNOWN

Source§

fn deserialise(_buf: &mut dyn Buf) -> Result<!, SerError>

Source§

impl Deserialiser<u64> for u64

Source§

const SER_ID: u64 = serialisation_ids::U64

Source§

fn deserialise(buf: &mut dyn Buf) -> Result<u64, SerError>

Source§

impl Deserialiser<()> for ()

Source§

const SER_ID: u64 = serialisation_ids::UNIT

Source§

fn deserialise(_buf: &mut dyn Buf) -> Result<(), SerError>

Source§

impl Deserialiser<String> for String

Source§

const SER_ID: u64 = serialisation_ids::STR

Source§

fn deserialise(buf: &mut dyn Buf) -> Result<String, SerError>

Implementors§

Source§

impl Deserialiser<ActorPath> for ActorPath

Source§

const SER_ID: u64 = serialisation_ids::ACTOR_PATH

Source§

impl Deserialiser<SystemPath> for SystemPath

Source§

const SER_ID: u64 = serialisation_ids::SYSTEM_PATH