pub trait Encoding:
'static
+ Sealed
+ Send
+ Sync
+ Debug {
// Required methods
fn as_any(&self) -> &dyn Any;
fn to_encoding(&self) -> EncodingRef;
fn into_encoding(self) -> EncodingRef
where Self: Sized;
fn id(&self) -> EncodingId;
fn build(
&self,
dtype: &DType,
len: usize,
metadata: &[u8],
buffers: &[ByteBuffer],
children: &dyn ArrayChildren,
) -> VortexResult<ArrayRef>;
fn encode(
&self,
input: &Canonical,
like: Option<&dyn Array>,
) -> VortexResult<Option<ArrayRef>>;
}
Expand description
Marker trait for array encodings with their associated Array type.
Required Methods§
fn to_encoding(&self) -> EncodingRef
fn into_encoding(self) -> EncodingRefwhere
Self: Sized,
Sourcefn id(&self) -> EncodingId
fn id(&self) -> EncodingId
Returns the ID of the encoding.
Sourcefn build(
&self,
dtype: &DType,
len: usize,
metadata: &[u8],
buffers: &[ByteBuffer],
children: &dyn ArrayChildren,
) -> VortexResult<ArrayRef>
fn build( &self, dtype: &DType, len: usize, metadata: &[u8], buffers: &[ByteBuffer], children: &dyn ArrayChildren, ) -> VortexResult<ArrayRef>
Build an array from its parts.
Sourcefn encode(
&self,
input: &Canonical,
like: Option<&dyn Array>,
) -> VortexResult<Option<ArrayRef>>
fn encode( &self, input: &Canonical, like: Option<&dyn Array>, ) -> VortexResult<Option<ArrayRef>>
Encode the canonical array into this encoding implementation.
Returns None
if this encoding does not support the given canonical array, for example
if the data type is incompatible.
Panics if like
is encoded with a different encoding.