AUDIO
Source snapshot · 11 November 2026

API reference / ravet_audio_file::ReadAheadPump

Trait ReadAheadPump 

pub trait ReadAheadPump: Send + 'static {
    // Required methods
    fn pump(&mut self) -> Result<ReadAheadProgress, AudioFileError>;
    fn owns(&self, consumer: &AudioConsumer) -> bool;
    fn pending_frames(&self) -> usize;
    fn reader_position(&self) -> u64;
    fn sample_rate(&self) -> u32;
    fn seek_stopped(
        &mut self,
        consumer: &mut AudioConsumer,
        frame: u64,
    ) -> Result<(), AudioFileError>;

    // Provided method
    fn worker_progressed(&self, progress: &ReadAheadProgress) -> bool { ... }
}
Expand description

Worker-only queue source for an automatic read-ahead owner. All cursors, seek targets and ReadAheadProgress frame counts use this source queue’s sample rate. Native readers publish original-rate frames; explicit converted sources publish output-rate frames and expose original input coordinates separately. Implementations must preserve queued/pending/cursor state on failed stopped seeks, and must publish only complete frames to their unique producer. Pump calls must be bounded; worker backend allocations and I/O remain explicit.

Required Methods§

fn pump(&mut self) -> Result<ReadAheadProgress, AudioFileError>

Perform one bounded read/publication attempt outside the audio callback.

fn owns(&self, consumer: &AudioConsumer) -> bool

Check that this source owns the consumer’s matching producer.

fn pending_frames(&self) -> usize

Remaining worker scratch frames not yet published to the ring.

fn reader_position(&self) -> u64

Queue-source generated/read position, including pending and queued frames. Converted implementations use target-rate output frames, not input frames.

fn sample_rate(&self) -> u32

Fixed queue-source sample rate; conversion is explicit in its implementation.

fn seek_stopped( &mut self, consumer: &mut AudioConsumer, frame: u64, ) -> Result<(), AudioFileError>

Position exactly in queue-source frames, clearing generation only after success.

Provided Methods§

fn worker_progressed(&self, progress: &ReadAheadProgress) -> bool

Whether the immediately preceding pump made bounded worker progress. Pure, bounded observation only: no I/O, blocking or allocation. Native default uses new publication; explicitly converted sources can include input read/consumption/output generation. An unchanged full ring is false.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

§

impl ReadAheadPump for CompressedReadAhead

§

impl<R: IndexedPlaybackReader + Send + 'static, F: FnMut() -> Result<R, AudioFileError> + Send + 'static> ReadAheadPump for IndexedConvertedReadAhead<R, F>

§

impl<R: PlaybackReader + Send + 'static, F: FnMut() -> Result<R, AudioFileError> + Send + 'static> ReadAheadPump for ConvertedReadAhead<R, F>

§

impl<R: Read + Seek + Send + 'static> ReadAheadPump for AiffReadAhead<R>

§

impl<R: Read + Seek + Send + 'static> ReadAheadPump for WaveReadAhead<R>