pub trait Encode {
// Required methods
fn encode<B: BufMut>(
&self,
buf: &mut B,
version: i16,
) -> Result<(), ProtocolError>;
fn encoded_len(&self, version: i16) -> usize;
}Expand description
Encode a Kafka wire-protocol value into a buffer at the given protocol version.
version is the message-level version negotiated via ApiVersionsRequest.
Implementations must produce bytes that are byte-equal to the upstream JVM
kafka-clients implementation for the same (message_type, version, value).
Required Methods§
fn encode<B: BufMut>( &self, buf: &mut B, version: i16, ) -> Result<(), ProtocolError>
Sourcefn encoded_len(&self, version: i16) -> usize
fn encoded_len(&self, version: i16) -> usize
Size in bytes that encode will write. Must equal the actual count.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".