use crate::error::Result;
use crate::Row;
use futures::stream::Stream;
use std::pin::Pin;
use std::task::{Context, Poll};
pub struct RowStream {
inner: Pin<Box<dyn Stream<Item = Result<Row>> + Send>>,
}
impl RowStream {
pub(crate) fn new_from_stream(stream: Pin<Box<dyn Stream<Item = Result<Row>> + Send>>) -> Self {
Self { inner: stream }
}
}
impl Stream for RowStream {
type Item = Result<Row>;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> {
self.inner.as_mut().poll_next(cx)
}
}
impl Unpin for RowStream {}