mz_persist_types::columnar

Trait 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§