2021-09-02 01:29:43 +00:00
|
|
|
use std::fmt::Display;
|
|
|
|
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
|
|
pub enum Type {
|
|
|
|
Int,
|
|
|
|
Float,
|
2021-09-04 21:52:57 +00:00
|
|
|
Range,
|
2021-09-02 01:29:43 +00:00
|
|
|
Bool,
|
|
|
|
String,
|
|
|
|
Block,
|
|
|
|
ColumnPath,
|
|
|
|
Duration,
|
|
|
|
FilePath,
|
|
|
|
Filesize,
|
|
|
|
List(Box<Type>),
|
|
|
|
Number,
|
|
|
|
Nothing,
|
|
|
|
Table,
|
2021-09-04 06:52:28 +00:00
|
|
|
RowStream,
|
|
|
|
ValueStream,
|
2021-09-02 01:29:43 +00:00
|
|
|
Unknown,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Display for Type {
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
match self {
|
|
|
|
Type::Block => write!(f, "block"),
|
|
|
|
Type::Bool => write!(f, "bool"),
|
|
|
|
Type::ColumnPath => write!(f, "column path"),
|
|
|
|
Type::Duration => write!(f, "duration"),
|
|
|
|
Type::FilePath => write!(f, "filepath"),
|
|
|
|
Type::Filesize => write!(f, "filesize"),
|
|
|
|
Type::Float => write!(f, "float"),
|
|
|
|
Type::Int => write!(f, "int"),
|
2021-09-04 21:52:57 +00:00
|
|
|
Type::Range => write!(f, "range"),
|
2021-09-02 01:29:43 +00:00
|
|
|
Type::List(l) => write!(f, "list<{}>", l),
|
|
|
|
Type::Nothing => write!(f, "nothing"),
|
|
|
|
Type::Number => write!(f, "number"),
|
|
|
|
Type::String => write!(f, "string"),
|
|
|
|
Type::Table => write!(f, "table"),
|
2021-09-04 06:52:28 +00:00
|
|
|
Type::ValueStream => write!(f, "value stream"),
|
|
|
|
Type::RowStream => write!(f, "row stream"),
|
2021-09-02 01:29:43 +00:00
|
|
|
Type::Unknown => write!(f, "unknown"),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|