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§


const SIZE: usize

Number of bytes the encoded format requires.

Required Methods§


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

Returns the encoded bytes as a slice.


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.


fn from_value(value: T) -> Self

Encode a type of T into this format.


fn into_value(self) -> T

Decode an instance of T from this format.

Object Safety§

This trait is not object safe.