Skip to main content

PayloadDecode

Trait PayloadDecode 

Source
pub trait PayloadDecode<T>: PayloadHooks + ProtocolSchema {
    // Required method
    fn decode(buf: &[u8], ctx: &mut Self::Context<'_>) -> Result<T>;
}
Expand description

Trait for decoding a payload from a byte buffer.

Requires PayloadHooks, so after_decode() will always be called after decoding.

Required Methods§

Source

fn decode(buf: &[u8], ctx: &mut Self::Context<'_>) -> Result<T>

Reconstructs a payload value from encoded payload bytes.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl PayloadDecode<String> for String

Source§

fn decode(buf: &[u8], _: &mut Self::Context<'_>) -> Result<String>

Source§

impl PayloadDecode<Vec<u8>> for Vec<u8>

Source§

fn decode(buf: &[u8], _: &mut Self::Context<'_>) -> Result<Vec<u8>>

Implementors§