pub trait PerCodecTunables: Codec {
type Tunables: Clone + Send + Sync + 'static;
// Required method
fn compress_with_owned_tunables(
&self,
plaintext: &[u8],
tunables: &Self::Tunables,
) -> Result<Vec<u8>, CoreError>;
}Expand description
Optional trait: codecs with strongly-typed per-codec tunables.
The flat CodecTunables struct works for today’s six codec
families but doesn’t scale. Codecs that want clean OCP for their
own knobs implement this trait alongside Codec; new codecs
= one impl PerCodecTunables with a fresh Tunables type, no
edits to existing code or to the flat struct.
The flat CodecTunables remains the dispatch entry point for
callers that want a single uniform struct; codecs that implement
PerCodecTunables can read from it inside their
compress_with_tunables override.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".