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