pub trait ArrowIpcStreamResponse {
// Required method
fn arrow_ipc_stream<'a>(
self,
max_obj_len: usize,
) -> BoxStream<'a, StreamBodyResult<RecordBatch>>;
}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§
fn arrow_ipc_stream<'a>( self, max_obj_len: usize, ) -> BoxStream<'a, StreamBodyResult<RecordBatch>>
Implementations on Foreign Types§
Source§impl ArrowIpcStreamResponse for Response
impl ArrowIpcStreamResponse for Response
Source§fn arrow_ipc_stream<'a>(
self,
max_obj_len: usize,
) -> BoxStream<'a, StreamBodyResult<RecordBatch>>
fn arrow_ipc_stream<'a>( self, max_obj_len: usize, ) -> BoxStream<'a, StreamBodyResult<RecordBatch>>
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(())
}