rgwml 2.0.0

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

use super::DataType;

#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Field {
    pub name: Arc<str>,
    pub dtype: DataType,
    pub nullable: bool,
}

impl Field {
    pub fn new(name: impl Into<Arc<str>>, dtype: DataType) -> Self {
        Self {
            name: name.into(),
            dtype,
            nullable: true,
        }
    }

    pub fn not_null(mut self) -> Self {
        self.nullable = false;
        self
    }

    pub fn with_nullability(mut self, nullable: bool) -> Self {
        self.nullable = nullable;
        self
    }
}