Skip to main content

vantage_table/traits/
column_like.rs

1use serde_json::Value;
2use std::collections::HashSet;
3
4use crate::column::{core::ColumnType, flags::ColumnFlag};
5
6/// Trait defines a minimal implementation for a Table column with type information
7///
8pub trait ColumnLike<T = Value>: Send + Sync + std::fmt::Debug
9where
10    T: ColumnType,
11{
12    fn name(&self) -> &str;
13    fn alias(&self) -> Option<&str> {
14        None
15    }
16    fn flags(&self) -> HashSet<ColumnFlag>;
17    fn as_any(&self) -> &dyn std::any::Any;
18    fn into_any(self: Box<Self>) -> Box<dyn std::any::Any>;
19    fn get_type(&self) -> &'static str {
20        std::any::type_name::<T>()
21    }
22}