reth_nippy_jar::compression

Trait Compression

Source
pub trait Compression: Serialize + for<'a> Deserialize<'a> {
    // Required methods
    fn decompress_to(
        &self,
        value: &[u8],
        dest: &mut Vec<u8>,
    ) -> Result<(), NippyJarError>;
    fn decompress(&self, value: &[u8]) -> Result<Vec<u8>, NippyJarError>;
    fn compress_to(
        &self,
        src: &[u8],
        dest: &mut Vec<u8>,
    ) -> Result<usize, NippyJarError>;
    fn compress(&self, src: &[u8]) -> Result<Vec<u8>, NippyJarError>;

    // Provided method
    fn is_ready(&self) -> bool { ... }
}
Expand description

Trait that will compress column values

Required Methods§

Source

fn decompress_to( &self, value: &[u8], dest: &mut Vec<u8>, ) -> Result<(), NippyJarError>

Appends decompressed data to the dest buffer. Requires dest to have sufficient capacity.

Source

fn decompress(&self, value: &[u8]) -> Result<Vec<u8>, NippyJarError>

Returns decompressed data.

Source

fn compress_to( &self, src: &[u8], dest: &mut Vec<u8>, ) -> Result<usize, NippyJarError>

Appends compressed data from src to dest. dest. Requires dest to have sufficient capacity.

Returns number of bytes written to dest.

Source

fn compress(&self, src: &[u8]) -> Result<Vec<u8>, NippyJarError>

Compresses data from src

Provided Methods§

Source

fn is_ready(&self) -> bool

Returns true if it’s ready to compress.

Example: it will return false, if zstd with dictionary is set, but wasn’t generated.

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§