Trait PayloadToBytes
pub trait PayloadToBytes {
// Required methods
fn binary_size(&self) -> usize;
fn write<W>(&self, metadata: &EventMetadata, writer: W) -> Result<(), Error>
where W: Write;
}
Expand description
Trait for converting event payloads to bytes
Required Methods§
fn binary_size(&self) -> usize
fn binary_size(&self) -> usize
Get the binary size of the payload
This is the size of the payload in bytes, excluding the event header. This can (and should) be used to preallocate buffers for writing the payload.
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.