pub trait Destination: Sized {
type TypeSystem: TypeSystem;
type Partition<'a>: DestinationPartition<'a, TypeSystem = Self::TypeSystem, Error = Self::Error>
where Self: 'a;
type Error: From<ConnectorXError> + Send;
const DATA_ORDERS: &'static [DataOrder];
// Required methods
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];
}
Expand description
A Destination
is associated with a TypeSystem
and a PartitionDestination
.
PartitionDestination
allows multiple threads write data into the buffer owned by Destination
.
Required Associated Constants§
const DATA_ORDERS: &'static [DataOrder]
Required Associated Types§
type TypeSystem: TypeSystem
type Partition<'a>: DestinationPartition<'a, TypeSystem = Self::TypeSystem, Error = Self::Error> where Self: 'a
type Error: From<ConnectorXError> + Send
Required Methods§
sourcefn needs_count(&self) -> bool
fn needs_count(&self) -> bool
Specify whether the destination needs total rows in advance in order to pre-allocate the buffer.
sourcefn allocate<S: AsRef<str>>(
&mut self,
nrow: usize,
names: &[S],
schema: &[Self::TypeSystem],
data_order: DataOrder,
) -> Result<(), Self::Error>
fn allocate<S: AsRef<str>>( &mut self, nrow: usize, names: &[S], schema: &[Self::TypeSystem], data_order: DataOrder, ) -> Result<(), Self::Error>
Construct the Destination
.
This allocates the memory based on the types of each columns
and the number of rows.
sourcefn partition(
&mut self,
counts: usize,
) -> Result<Vec<Self::Partition<'_>>, Self::Error>
fn partition( &mut self, counts: usize, ) -> Result<Vec<Self::Partition<'_>>, Self::Error>
Create a bunch of partition destinations, with each write count
number of rows.
sourcefn schema(&self) -> &[Self::TypeSystem]
fn schema(&self) -> &[Self::TypeSystem]
Return the schema of the destination.
Object Safety§
This trait is not object safe.