BinaryTransform

Trait BinaryTransform 

Source
pub trait BinaryTransform {
    // Required method
    fn transform(&self, data: Bytes) -> Result<Bytes, Error>;

    // Provided method
    fn transform_mut(&mut self, data: Bytes) -> Result<Bytes, Error> { ... }
}
Expand description

Defines a transformation on a set of binary data.

This is specifically designed to operate on entire messages instead of streams, in order to better match now WebSocket messages are handled.

Examples are compression and decompression.

Required Methods§

Source

fn transform(&self, data: Bytes) -> Result<Bytes, Error>

Applies the transform to the data, returning the resulting transformed data.

The caller retains ownership of the source buffer.

Provided Methods§

Source

fn transform_mut(&mut self, data: Bytes) -> Result<Bytes, Error>

Applies the transform to the data while possibly mutating the transformer.

The caller retains ownership of the source buffer.

Default implementation simply forwards to [transform()].

Implementors§