pub trait PayloadEncodeReferred: ProtocolSchema {
// Required method
fn encode(&self, ctx: &mut Self::Context<'_>) -> 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§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".