Trait Compressor

Source
pub trait Compressor:
    Clone
    + Copy
    + Send
    + Sync {
    // Required methods
    fn compress(&self, packet: Packet) -> Result<Packet, Error>;
    fn decompress(&self, packet: Packet) -> Result<Packet, Error>;
}
Expand description

A Compressor is used to implement compression of packet values. A default implementation is provided for NoCompressor, as well as [ZlibCompressor].

If other compression algorithms are desired it is possible to implement this trait yourself and pass it into Client::new.

Required Methods§

Source

fn compress(&self, packet: Packet) -> Result<Packet, Error>

Consume a packet, returning a (possibly) modified packet with the packet value compressed. This should set the appropriate packet flags on the extras field.

Source

fn decompress(&self, packet: Packet) -> Result<Packet, Error>

Consume a packet, returning a (possibly) modified packet with the packet value decompressed. This should unset the appropriate packet flags on the extras field.

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.

Implementors§