Trait FrameDecoder

Source
pub trait FrameDecoder {
    // Required method
    fn consume(
        &mut self,
        data: &mut Vec<u8>,
        compression: Compression,
    ) -> Result<Vec<Envelope>>;
}
Expand description

A decoder for frames. Since protocol v5, frames became “envelopes” and a frame now can contain multiple complete envelopes (self-contained frame) or a part of one bigger envelope.

Required Methods§

Source

fn consume( &mut self, data: &mut Vec<u8>, compression: Compression, ) -> Result<Vec<Envelope>>

Consumes some data and returns decoded envelopes. Decoders can be stateful, so data can be buffered until envelopes can be parsed. The buffer passed in should be cleared of consumed data by the decoder.

Implementors§