Skip to main content

Compressor

Trait Compressor 

Source
pub trait Compressor {
    // Required methods
    fn matches(&self, command: &str) -> bool;
    fn compress(&self, command: &str, output: &str) -> String;

    // Provided method
    fn specificity(&self) -> Specificity { ... }
}
Expand description

A Compressor knows how to reduce one specific command’s output to fewer tokens while preserving the information the agent needs.

Required Methods§

Source

fn matches(&self, command: &str) -> bool

Returns true if this compressor handles the given command head + args. Called after generic detection (ANSI strip, dedup) so this is per-command logic only.

Source

fn compress(&self, command: &str, output: &str) -> String

Compress the output. Original is left untouched if compression fails.

Provided Methods§

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§