use crate::DuckOptionResult;
use super::dynamic_row::DuckDynamicRow;
use super::result_schema::DuckResultSchema;
pub type DuckDynamicIterator = Box<dyn Iterator<Item = DuckOptionResult<DuckDynamicRow>> + Send>;
pub struct DuckDynamicTable {
schema: DuckResultSchema,
rows: DuckDynamicIterator,
}
impl DuckDynamicTable {
#[must_use]
pub fn new(schema: DuckResultSchema, rows: DuckDynamicIterator) -> Self {
Self { schema, rows }
}
#[must_use]
pub fn schema(&self) -> &DuckResultSchema {
&self.schema
}
#[must_use]
pub fn into_parts(self) -> (DuckResultSchema, DuckDynamicIterator) {
(self.schema, self.rows)
}
}
impl std::fmt::Debug for DuckDynamicTable {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("DuckDynamicTable")
.field("schema", &self.schema)
.finish_non_exhaustive()
}
}