use std::pin::Pin;
pub use adapter::*;
pub use ext::*;
use futures::Stream;
use futures::stream;
use vortex_error::VortexResult;
use crate::ArrayRef;
use crate::dtype::DType;
mod adapter;
mod ext;
pub trait ArrayStream: Stream<Item = VortexResult<ArrayRef>> {
fn dtype(&self) -> &DType;
}
pub type SendableArrayStream = Pin<Box<dyn ArrayStream + Send>>;
impl ArrayStream for SendableArrayStream {
fn dtype(&self) -> &DType {
(**self).dtype()
}
}
impl ArrayRef {
pub fn to_array_stream(&self) -> impl ArrayStream + 'static {
ArrayStreamAdapter::new(self.dtype().clone(), stream::iter(self.to_array_iterator()))
}
}