Skip to main content

ColumnValue

Trait ColumnValue 

Source
pub trait ColumnValue: Copy + PartialEq {
    const IS_INTEGER: bool;

    // Required methods
    fn to_bits(self) -> u64;
    fn from_bits(bits: u64) -> Option<Self>;
}
Expand description

A value that can live in an encoded column.

Encodings work on the bit pattern, so anything with a lossless 64-bit representation qualifies. Bit-packing a float is legal and never chosen: the encoder’s rules only reach for it where the values are small integers.

Required Associated Constants§

Source

const IS_INTEGER: bool

Whether the bit pattern is an integer, so that narrowing it or taking differences between successive values means something.

False for floating point. Bit-packing a float would sometimes succeed — small floats have leading zero bits — and would produce a column whose size depended on the exponents in it, which is not an encoding anyone chose.

Required Methods§

Source

fn to_bits(self) -> u64

The value as bits.

Source

fn from_bits(bits: u64) -> Option<Self>

The value from bits.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ColumnValue for f32

Source§

const IS_INTEGER: bool = false

Source§

fn to_bits(self) -> u64

Source§

fn from_bits(bits: u64) -> Option<Self>

Source§

impl ColumnValue for i8

Source§

const IS_INTEGER: bool = true

Source§

fn to_bits(self) -> u64

Source§

fn from_bits(bits: u64) -> Option<Self>

Source§

impl ColumnValue for i16

Source§

const IS_INTEGER: bool = true

Source§

fn to_bits(self) -> u64

Source§

fn from_bits(bits: u64) -> Option<Self>

Source§

impl ColumnValue for i32

Source§

const IS_INTEGER: bool = true

Source§

fn to_bits(self) -> u64

Source§

fn from_bits(bits: u64) -> Option<Self>

Source§

impl ColumnValue for i64

Source§

const IS_INTEGER: bool = true

Source§

fn to_bits(self) -> u64

Source§

fn from_bits(bits: u64) -> Option<Self>

Source§

impl ColumnValue for u8

Source§

const IS_INTEGER: bool = true

Source§

fn to_bits(self) -> u64

Source§

fn from_bits(bits: u64) -> Option<Self>

Source§

impl ColumnValue for u16

Source§

const IS_INTEGER: bool = true

Source§

fn to_bits(self) -> u64

Source§

fn from_bits(bits: u64) -> Option<Self>

Source§

impl ColumnValue for u32

Source§

const IS_INTEGER: bool = true

Source§

fn to_bits(self) -> u64

Source§

fn from_bits(bits: u64) -> Option<Self>

Source§

impl ColumnValue for u64

Source§

const IS_INTEGER: bool = true

Source§

fn to_bits(self) -> u64

Source§

fn from_bits(bits: u64) -> Option<Self>

Implementors§