blob: 87c317c083f3ba529f25bf91a0ec33cb33ff3c9b [file] [log] [blame]
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//! Trait definitions specific to using Arrow with async.
use arrow_schema::{ArrowError, SchemaRef};
use crate::record_batch::RecordBatch;
/// Trait for an asynchronous stream of `RecordBatch`es.
pub trait RecordBatchStream: futures::Stream<Item = Result<RecordBatch, ArrowError>> {
/// Return the schema of this `RecordBatchStream`.
///
/// Implementation of this trait should guarantee that all `RecordBatch`'s returned by this
/// reader should have the same schema as returned from this method.
fn schema(&self) -> &SchemaRef;
}