arrow_array/nonblocking.rs
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: See the NOTICE file distributed with this work for additional information regarding copyright ownership
3// SPDX-FileContributor: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements
4
5//! Trait definitions specific to using Arrow with async.
6
7use arrow_schema::{ArrowError, SchemaRef};
8
9use crate::record_batch::RecordBatch;
10
11/// Trait for an asynchronous stream of `RecordBatch`es.
12pub trait RecordBatchStream: futures::Stream<Item = Result<RecordBatch, ArrowError>> {
13 /// Return the schema of this `RecordBatchStream`.
14 ///
15 /// Implementation of this trait should guarantee that all `RecordBatch`'s returned by this
16 /// reader should have the same schema as returned from this method.
17 fn schema(&self) -> &SchemaRef;
18}