vortex_array/encoding.rs
1//! Traits and types to define shared unique encoding identifiers.
2
3use std::fmt::Debug;
4
5use crate::arcref::ArcRef;
6use crate::vtable::{EncodingVTable, VTableRef};
7use crate::{Array, DeserializeMetadata, SerializeMetadata};
8
9/// EncodingId is a globally unique name of the array's encoding.
10pub type EncodingId = ArcRef<str>;
11
12/// Marker trait for array encodings with their associated Array type.
13pub trait Encoding: 'static + Send + Sync + EncodingVTable {
14 type Array: Array;
15 type Metadata: SerializeMetadata + DeserializeMetadata + Debug;
16
17 fn vtable(&'static self) -> VTableRef
18 where
19 Self: Sized,
20 {
21 VTableRef::new_ref(self)
22 }
23}