Trait PayloadEncodeReferred

Source
pub trait PayloadEncodeReferred {
    // Required method
    fn encode(&self) -> Result<Option<&[u8]>>;
}
Expand description

Provides an optional reference to an already-encoded payload.

This is a performance optimization: if the payload was already serialized, this trait can return a reference to the existing bytes and skip re-encoding.

Useful in zero-copy or deferred encoding scenarios.

Required Methods§

Source

fn encode(&self) -> Result<Option<&[u8]>>

Optionally returns a reference to a pre-encoded payload.

§Returns
  • Some(&[u8]) if the encoded buffer is available.
  • None if the payload must be encoded with PayloadEncode.

Implementations on Foreign Types§

Source§

impl PayloadEncodeReferred for String

Source§

fn encode(&self) -> Result<Option<&[u8]>>

Source§

impl PayloadEncodeReferred for Vec<u8>

Source§

fn encode(&self) -> Result<Option<&[u8]>>

Implementors§