vortex_array/vtable/
mod.rs1use std::fmt::{Debug, Display, Formatter};
4use std::hash::{Hash, Hasher};
5
6mod compute;
7mod serde;
8mod statistics;
9
10pub use compute::*;
11pub use serde::*;
12pub use statistics::*;
13
14use crate::Array;
15use crate::arcref::ArcRef;
16use crate::encoding::EncodingId;
17
18pub type VTableRef = ArcRef<dyn EncodingVTable>;
20
21pub trait EncodingVTable:
28 'static
29 + Sync
30 + Send
31 + ComputeVTable
32 + for<'a> SerdeVTable<&'a dyn Array>
33 + for<'a> StatisticsVTable<&'a dyn Array>
34{
35 fn id(&self) -> EncodingId;
37}
38
39impl PartialEq for dyn EncodingVTable + '_ {
40 fn eq(&self, other: &Self) -> bool {
41 self.id() == other.id()
42 }
43}
44
45impl Eq for dyn EncodingVTable + '_ {}
46
47impl Hash for dyn EncodingVTable + '_ {
48 fn hash<H: Hasher>(&self, state: &mut H) {
49 self.id().hash(state)
50 }
51}
52
53impl Debug for dyn EncodingVTable + '_ {
54 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
55 write!(f, "{}", self.id())
56 }
57}
58
59impl Display for dyn EncodingVTable + '_ {
60 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
61 write!(f, "{}", self.id())
62 }
63}