pub trait SampleCodec: Sync {
// Required methods
fn id(&self) -> u8;
fn encode(&self, buffer: &Buffer, out: &mut Vec<u8>);
fn decode(
&self,
bytes: &[u8],
rate: u32,
width: usize,
samples: usize,
) -> Option<Buffer>;
}Expand description
A persisted entry’s samples. The id is written into every entry, and a store reading an entry another codec wrote answers a miss: the bytes are not wrong, only not its own.
Only an exact codec, one whose round trip is bit-identical, may implement this until keyed, opt-in approximate storage exists: a lossy one would change the value a key names.
Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".