pub fn compress(self) -> Result<Self> {
        let raw = self.encode();

        let mut z = ZlibEncoder::new(Vec::new(), Compression::default());
        z.write_all(&raw)?;
        let data = z.finish()?;

        Ok(Self::new(self.op, Protocol::Zlib, data))
    }
/// Convert a JSON/Int32BE packet to a zlib-compressed one.
///
/// # Errors
/// Return errors if compression fails.
Convert a JSON/Int32BE packet to a zlib-compressed one.
Convert a JSON / Int32BE packet to a zlib - compressed one .
pub fn compress(self) -> Result<Self> {
        let raw = self.encode();
        let mut z = ZlibEncoder::new(Vec::new(), Compression::default());
        z.write_all(&raw)?;
        let data = z.finish()?;
        Ok(Self::new(self.op, Protocol::Zlib, data))
    }
pub fn compress ( self ) -> Result < Self > { let raw = self . encode ( ) ; let mut z = ZlibEncoder :: new ( Vec :: new ( ) , Compression :: default ( ) ) ; z . write_all ( & raw ) ? ; let data = z . finish ( ) ? ; Ok ( Self :: new ( self . op , Protocol :: Zlib , data ) ) }
Convert a JSON/Int32BE packet to a zlib-compressed one.
Convert a JSON / Int32BE packet to a zlib - compressed one .
self
self
errors
Return errors if compression fails.
Return errors if compression fails .