pub mod arrow;
pub mod arrowstream;
use crate::connectorx::data_order::DataOrder;
use crate::connectorx::errors::ConnectorXError;
use crate::connectorx::typesystem::{TypeAssoc, TypeSystem};
pub trait Destination: Sized {
const DATA_ORDERS: &'static [DataOrder];
type TypeSystem: TypeSystem;
type Partition<'a>: DestinationPartition<'a, TypeSystem = Self::TypeSystem, Error = Self::Error>
where
Self: 'a;
type Error: From<ConnectorXError> + Send;
fn needs_count(&self) -> bool;
fn allocate<S: AsRef<str>>(
&mut self,
nrow: usize,
names: &[S],
schema: &[Self::TypeSystem],
data_order: DataOrder,
) -> Result<(), Self::Error>;
fn partition(&mut self, counts: usize) -> Result<Vec<Self::Partition<'_>>, Self::Error>;
fn schema(&self) -> &[Self::TypeSystem];
}
pub trait DestinationPartition<'a>: Send {
type TypeSystem: TypeSystem;
type Error: From<ConnectorXError> + Send;
fn write<T>(&mut self, value: T) -> Result<(), <Self as DestinationPartition<'a>>::Error>
where
T: TypeAssoc<Self::TypeSystem>,
Self: Consume<T, Error = <Self as DestinationPartition<'a>>::Error>,
{
self.consume(value)
}
fn ncols(&self) -> usize;
fn finalize(&mut self) -> Result<(), Self::Error>;
fn aquire_row(&mut self, n: usize) -> Result<usize, Self::Error>;
}
pub trait Consume<T> {
type Error: From<ConnectorXError> + Send;
fn consume(&mut self, value: T) -> Result<(), Self::Error>;
}