[][src]Function cql_f64::unpack_stream

pub fn unpack_stream<F>(
    stream: &mut Cursor<Vec<u8>>,
    n_values: usize,
    value_handler: F
) -> Result<()> where
    F: FnMut(usize, f64), 

Unpacks n_values of f64 from a stream, calling value_handler with each value and it's index.

Errors

Will return any I/O errors encountered during the execution of the function. If an error is returned, it may be that values have already been fed into the value_handler.

Panics

Function does not actively defend against panics, and may do so if given invalid parameters. If the function panics it may be that values have already been fed into the value_handler.

Examples

This example is not tested
cql_db::read_to_stream::<F64>(
    DATABASE_LOCATION,
    &mut stream,
    &base_point,
    N_VALUES_TO_READ as u64
)?;

stream.seek(SeekFrom::Start(0));

unpack_stream(&mut stream, N_VALUES_TO_READ, |idx, value| {
    result[idx] = value
})?;