vortex_array/stream/
mod.rs1use std::pin::Pin;
5
6pub use adapter::*;
7pub use ext::*;
8use futures::Stream;
9use futures::stream;
10use vortex_error::VortexResult;
11
12use crate::ArrayRef;
13use crate::dtype::DType;
14
15mod adapter;
16mod ext;
17
18pub trait ArrayStream: Stream<Item = VortexResult<ArrayRef>> {
22 fn dtype(&self) -> &DType;
23}
24
25pub type SendableArrayStream = Pin<Box<dyn ArrayStream + Send>>;
27
28impl ArrayStream for SendableArrayStream {
29 fn dtype(&self) -> &DType {
30 (**self).dtype()
31 }
32}
33
34impl ArrayRef {
35 pub fn to_array_stream(&self) -> impl ArrayStream + 'static {
37 ArrayStreamAdapter::new(self.dtype().clone(), stream::iter(self.to_array_iterator()))
38 }
39}