rgwml 2.0.0

Typed, local-first tabular data library with columnar in-memory storage.
Documentation
use std::fmt;

#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum DataType {
    Bool,
    I64,
    F64,
    Utf8,
    DictUtf8,
    Date32,
    TimestampMs,
}

impl DataType {
    pub fn is_fixed_width(self) -> bool {
        matches!(
            self,
            Self::Bool | Self::I64 | Self::F64 | Self::Date32 | Self::TimestampMs
        )
    }

    pub fn display_name(self) -> &'static str {
        match self {
            Self::Bool => "bool",
            Self::I64 => "i64",
            Self::F64 => "f64",
            Self::Utf8 => "utf8",
            Self::DictUtf8 => "dict_utf8",
            Self::Date32 => "date32",
            Self::TimestampMs => "timestamp_ms",
        }
    }
}

impl fmt::Display for DataType {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.display_name())
    }
}