Trait ArrowIpcStreamResponse

Source
pub trait ArrowIpcStreamResponse {
    // Required method
    fn arrow_ipc_stream<'a>(
        self,
        max_obj_len: usize,
    ) -> impl Stream<Item = StreamBodyResult<RecordBatch>> + Send + 'a;
}
Available on crate feature arrow only.
Expand description

Extension trait for reqwest::Response that provides streaming support for the Apache Arrow IPC format.

Required Methods§

Source

fn arrow_ipc_stream<'a>( self, max_obj_len: usize, ) -> impl Stream<Item = StreamBodyResult<RecordBatch>> + Send + 'a

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl ArrowIpcStreamResponse for Response

Source§

fn arrow_ipc_stream<'a>( self, max_obj_len: usize, ) -> impl Stream<Item = StreamBodyResult<RecordBatch>> + Send + 'a

Streams the response as batches of Arrow IPC messages.

The stream will deserialize entries into RecordBatches with a maximum object size of max_obj_len bytes.

§Example
use arrow::array::RecordBatch;
use futures::{prelude::*, stream::BoxStream as _};
use reqwest_streams::ArrowIpcStreamResponse as _;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    const MAX_OBJ_LEN: usize = 64 * 1024;

    let stream = reqwest::get("http://localhost:8080/arrow")
        .await?
        .arrow_ipc_stream(MAX_OBJ_LEN);
    let _items: Vec<RecordBatch> = stream.try_collect().await?;

    Ok(())
}

Implementors§