Trait Encoding

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

Source

fn as_any(&self) -> &dyn Any

Downcast the encoding to Any.

Source

fn to_encoding(&self) -> EncodingRef

Source

fn into_encoding(self) -> EncodingRef
where Self: Sized,

Source

fn id(&self) -> EncodingId

Returns the ID of the encoding.

Source

fn build( &self, dtype: &DType, len: usize, metadata: &[u8], buffers: &[ByteBuffer], children: &dyn ArrayChildren, ) -> VortexResult<ArrayRef>

Build an array from its parts.

Source

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.

Implementations§

Source§

impl dyn Encoding + '_

Source

pub fn as_<V: VTable>(&self) -> &V::Encoding

Trait Implementations§

Source§

impl AsRef<dyn Encoding> for BoolEncoding

Source§

fn as_ref(&self) -> &dyn Encoding

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn Encoding> for ChunkedEncoding

Source§

fn as_ref(&self) -> &dyn Encoding

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn Encoding> for ConstantEncoding

Source§

fn as_ref(&self) -> &dyn Encoding

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn Encoding> for DecimalEncoding

Source§

fn as_ref(&self) -> &dyn Encoding

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn Encoding> for ExtensionEncoding

Source§

fn as_ref(&self) -> &dyn Encoding

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn Encoding> for ListEncoding

Source§

fn as_ref(&self) -> &dyn Encoding

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn Encoding> for NullEncoding

Source§

fn as_ref(&self) -> &dyn Encoding

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn Encoding> for PrimitiveEncoding

Source§

fn as_ref(&self) -> &dyn Encoding

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn Encoding> for StructEncoding

Source§

fn as_ref(&self) -> &dyn Encoding

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn Encoding> for VarBinEncoding

Source§

fn as_ref(&self) -> &dyn Encoding

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<dyn Encoding> for VarBinViewEncoding

Source§

fn as_ref(&self) -> &dyn Encoding

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Display for dyn Encoding + '_

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for dyn Encoding + '_

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for dyn Encoding + '_

Implementors§