Trait mz_persist_types::columnar::FixedSizeCodec

source ·
pub trait FixedSizeCodec<T>:
    Debug
    + PartialEq
    + Eq {
    const SIZE: usize;

    // Required methods
    fn as_bytes(&self) -> &[u8] ;
    fn from_bytes(val: &[u8]) -> Result<Self, String>
       where Self: Sized;
    fn from_value(value: T) -> Self;
    fn into_value(self) -> T;
}
Expand description

A stable encoding for a type that gets durably persisted in an arrow::array::FixedSizeBinaryArray.

Required Associated Constants§

source

const SIZE: usize

Number of bytes the encoded format requires.

Required Methods§

source

fn as_bytes(&self) -> &[u8]

Returns the encoded bytes as a slice.

source

fn from_bytes(val: &[u8]) -> Result<Self, String>
where Self: Sized,

Create an instance of self from a slice.

Note: It is the responsibility of the caller to make sure the provided data is valid for self.

source

fn from_value(value: T) -> Self

Encode a type of T into this format.

source

fn into_value(self) -> T

Decode an instance of T from this format.

Object Safety§

This trait is not object safe.

Implementors§