Trait rsmc_core::client::Compressor[][src]

pub trait Compressor: Clone + Copy + Send + Sync {
    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

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

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

Implementors