Trait Recording Pump
pub trait RecordingPump: Send + 'static {
type Destination;
// Required methods
fn consumer(&self) -> &AudioConsumer;
fn owns(&self, producer: &AudioProducer) -> bool;
fn pump(&mut self) -> Result<usize, AudioFileError>;
fn frames(&self) -> u64;
fn finish(self) -> Result<Self::Destination, AudioFileError>;
}Expand description
Worker-only incremental recorder contract for an automatic owner. Each pump must drain at most prepared scratch capacity and perform no work when empty. Any failure after dequeue must poison subsequent source calls. Finalization requires the matching producer stopped and performs a bounded remaining-ring drain followed by explicit file/codec finalization.
Required Associated Types§
type Destination
type Destination
Caller-selected sink returned only after successful consuming finish.
Required Methods§
fn consumer(&self) -> &AudioConsumer
fn consumer(&self) -> &AudioConsumer
Stable exact owned consumer drained by pump/finish. It must identify the same ring for the recorder’s lifetime, including permanent retirement proof.
fn owns(&self, producer: &AudioProducer) -> bool
fn owns(&self, producer: &AudioProducer) -> bool
Check exact prepared producer/consumer identity outside callbacks.
fn pump(&mut self) -> Result<usize, AudioFileError>
fn pump(&mut self) -> Result<usize, AudioFileError>
Drain one bounded worker batch, returning successfully accepted frames.
fn frames(&self) -> u64
fn frames(&self) -> u64
Source count semantics remain explicit: WAV/AIFF count successful writes; FLAC counts accepted encoder frames, including retained pending blocks.
fn finish(self) -> Result<Self::Destination, AudioFileError>
fn finish(self) -> Result<Self::Destination, AudioFileError>
Drain bounded remaining input and finalize the sink with producer stopped.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".