vortex_array/stream/
mod.rs1use std::pin::Pin;
2
3pub use adapter::*;
4pub use ext::*;
5use futures_util::{Stream, stream};
6use vortex_dtype::DType;
7use vortex_error::VortexResult;
8
9use crate::{Array, ArrayRef};
10
11mod adapter;
12mod ext;
13
14pub trait ArrayStream: Stream<Item = VortexResult<ArrayRef>> {
18 fn dtype(&self) -> &DType;
19}
20
21pub type SendableArrayStream = Pin<Box<dyn ArrayStream + Send>>;
23
24impl ArrayStream for SendableArrayStream {
25 fn dtype(&self) -> &DType {
26 (**self).dtype()
27 }
28}
29
30impl dyn Array + '_ {
31 pub fn to_array_stream(&self) -> impl ArrayStream + 'static {
33 ArrayStreamAdapter::new(self.dtype().clone(), stream::iter(self.to_array_iterator()))
34 }
35}