connectorx::destinations

Trait Destination

Source
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§

Source

const DATA_ORDERS: &'static [DataOrder]

Required Associated Types§

Source

type TypeSystem: TypeSystem

Source

type Partition<'a>: DestinationPartition<'a, TypeSystem = Self::TypeSystem, Error = Self::Error> where Self: 'a

Source

type Error: From<ConnectorXError> + Send

Required Methods§

Source

fn needs_count(&self) -> bool

Specify whether the destination needs total rows in advance in order to pre-allocate the buffer.

Source

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.

Source

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.

Source

fn schema(&self) -> &[Self::TypeSystem]

Return the schema of the destination.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§