Skip to main content

pump_read_to_sink

Function pump_read_to_sink 

Source
pub fn pump_read_to_sink<R, D>(
    reader: R,
    decoder: &mut D,
    sink: &mut dyn DecodeRowSink,
    pulse: Option<&dyn Pulse>,
    read_size: usize,
    max_window: usize,
) -> Result<OutputInfo, PumpError<D::Error>>
where R: Read, D: IncrementalDecode + ?Sized,
Expand description

Pump a sequential stream into decoder, writing rows into sink.

The pump owns one window over the stream. It reads read_size bytes at a time (more when the decoder’s request needs a larger contiguous span, up to max_window), offers the window, and drops what the decoder took. A decoder decodes straight from the window; rows are emitted as soon as it has enough. Bytes the decoder skips ahead over are read and discarded; a request behind the stream position is PumpError::NeedsRandomAccess.