Skip to main content

Compressor

Trait Compressor 

Source
pub trait Compressor: Send + Sync {
    // Required methods
    fn kind(&self) -> CompressorKind;
    fn compress<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        input: &'life1 CompressInput<'life2>,
        opts: &'life3 CompressOptions,
    ) -> Pin<Box<dyn Future<Output = Option<CompressOutput>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

A content-aware compressor. Implementations are stateless and zero-sized; the registry hands out &'static references.

Required Methods§

Source

fn kind(&self) -> CompressorKind

Which CompressorKind this is (for stats/logs).

Source

fn compress<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, input: &'life1 CompressInput<'life2>, opts: &'life3 CompressOptions, ) -> Pin<Box<dyn Future<Output = Option<CompressOutput>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Compress input. Return None to decline (the router passes the original through). Some carries the compacted body and whether data was dropped. Async so the ML compressor can talk to its Python sidecar without a blocking bridge; native compressors complete synchronously.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§