Trait mz_persist_types::columnar::Data

source ·
pub trait Data:
    Debug
    + Send
    + Sync
    + Sized
    + 'static {
    type Cfg: ColumnCfg<Self>;
    type Ref<'a>: Default
       where Self: 'a;
    type Col: ColumnGet<Self>;
    type Mut: ColumnPush<Self>;
    type Stats: ColumnStats + StatsFrom<Self::Col>;
}
Expand description

A type understood by persist.

The equality and sorting of the encoded column matches those of this rust type.

This trait is implemented for owned types. However, for efficiency the columns themselves don’t store the owned types, so instead we read and write in terms of the associated Self::Ref. This is not simply &Self because e.g. it’s sometimes not possible for us to present the column as something like &Option<T> but we can always produce a Option<&T>. Tuples have a similar restriction.

This trait is intentionally “sealed” via the unexported Column trait.

There is a 1:1 mapping between implementors of Data and variants of the DataType enum. The parallel hierarchy exists so that Data can be ergonomic while DataType is object-safe and has exhaustiveness checking. A Data impl can be mapped to its corresponding DataType via ColumnCfg::as_type and back via DataType::data_fn.

TODO(parkmycar): Remove once Schema2 is fully flushed out.

Required Associated Types§

source

type Cfg: ColumnCfg<Self>

If necessary, whatever information beyond the type of Self needed to produce a columnar schema for this type.

Conceptually: type of Self + this config => columnar schema.

For most Data impls, this is not necessary and set to ().

source

type Ref<'a>: Default where Self: 'a

The associated reference type of Self used for reads and writes on columns of this type.

source

type Col: ColumnGet<Self>

The shared reference of columns of this type of data.

source

type Mut: ColumnPush<Self>

The exclusive builder of columns of this type of data.

source

type Stats: ColumnStats + StatsFrom<Self::Col>

The statistics type of columns of this type of data.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Data for Option<bool>

source§

impl Data for Option<f32>

source§

impl Data for Option<f64>

source§

impl Data for Option<i8>

source§

impl Data for Option<i16>

source§

impl Data for Option<i32>

source§

impl Data for Option<i64>

source§

impl Data for Option<u8>

source§

impl Data for Option<u16>

source§

impl Data for Option<u32>

source§

impl Data for Option<u64>

source§

impl Data for Option<DynStruct>

source§

impl Data for Option<String>

source§

impl Data for Option<Vec<u8>>

source§

impl Data for Option<OpaqueData>

source§

impl Data for bool

source§

impl Data for f32

source§

impl Data for f64

source§

impl Data for i8

source§

impl Data for i16

source§

impl Data for i32

source§

impl Data for i64

source§

impl Data for u8

source§

impl Data for u16

source§

impl Data for u32

source§

impl Data for u64

source§

impl Data for String

source§

impl Data for Vec<u8>

Implementors§