mod array;
mod compute;
mod decode;
mod encode;
mod operations;
mod operator;
mod serde;
mod validity;
mod visitor;
use std::fmt::Debug;
use std::ops::Deref;
pub use array::*;
pub use compute::*;
pub use decode::*;
pub use encode::*;
pub use operations::*;
pub use operator::*;
pub use serde::*;
pub use validity::*;
pub use visitor::*;
use crate::{Array, Encoding, EncodingId, EncodingRef, IntoArray};
pub trait VTable: 'static + Sized + Send + Sync + Debug {
type Array: 'static + Send + Sync + Clone + Debug + Deref<Target = dyn Array> + IntoArray;
type Encoding: 'static + Send + Sync + Clone + Deref<Target = dyn Encoding>;
type ArrayVTable: ArrayVTable<Self>;
type CanonicalVTable: CanonicalVTable<Self>;
type OperationsVTable: OperationsVTable<Self>;
type ValidityVTable: ValidityVTable<Self>;
type VisitorVTable: VisitorVTable<Self>;
type ComputeVTable: ComputeVTable<Self>;
type EncodeVTable: EncodeVTable<Self>;
type SerdeVTable: SerdeVTable<Self>;
type PipelineVTable: PipelineVTable<Self>;
fn id(encoding: &Self::Encoding) -> EncodingId;
fn encoding(array: &Self::Array) -> EncodingRef;
}
pub struct NotSupported;
#[macro_export]
macro_rules! vtable {
($V:ident) => {
$crate::aliases::paste::paste! {
#[derive(Debug)]
pub struct [<$V VTable>];
impl AsRef<dyn $crate::Array> for [<$V Array>] {
fn as_ref(&self) -> &dyn $crate::Array {
unsafe { &*(self as *const [<$V Array>] as *const $crate::ArrayAdapter<[<$V VTable>]>) }
}
}
impl std::ops::Deref for [<$V Array>] {
type Target = dyn $crate::Array;
fn deref(&self) -> &Self::Target {
unsafe { &*(self as *const [<$V Array>] as *const $crate::ArrayAdapter<[<$V VTable>]>) }
}
}
impl $crate::IntoArray for [<$V Array>] {
fn into_array(self) -> $crate::ArrayRef {
std::sync::Arc::new(unsafe { std::mem::transmute::<[<$V Array>], $crate::ArrayAdapter::<[<$V VTable>]>>(self) })
}
}
impl From<[<$V Array>]> for $crate::ArrayRef {
fn from(value: [<$V Array>]) -> $crate::ArrayRef {
use $crate::IntoArray;
value.into_array()
}
}
impl AsRef<dyn $crate::Encoding> for [<$V Encoding>] {
fn as_ref(&self) -> &dyn $crate::Encoding {
unsafe { &*(self as *const [<$V Encoding>] as *const $crate::EncodingAdapter<[<$V VTable>]>) }
}
}
impl std::ops::Deref for [<$V Encoding>] {
type Target = dyn $crate::Encoding;
fn deref(&self) -> &Self::Target {
unsafe { &*(self as *const [<$V Encoding>] as *const $crate::EncodingAdapter<[<$V VTable>]>) }
}
}
}
};
}