pub trait Codec {
// Required methods
fn name(&self) -> &str;
fn declared_lossless(&self) -> bool;
fn encode(&self, signal: &[Vec<i64>], fs: f64) -> Vec<u8> ⓘ;
fn decode(&self, blob: &[u8]) -> Vec<Vec<i64>>;
}Expand description
The codec-agnostic interface every benchmarked codec implements.
signal is one Vec<i64> of samples per channel; fs is the sample
rate in Hz (metadata the codec may use or ignore). encode returns
an opaque blob and decode reconstructs the per-channel samples.
A codec that advertises declared_lossless == true is claiming
bit-exact reconstruction; the harness verifies that claim against the
L-tier gate. The claim is what is graded — it is not assumed true.
Required Methods§
Sourcefn declared_lossless(&self) -> bool
fn declared_lossless(&self) -> bool
Whether the codec claims bit-exact reconstruction.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".